RISC-V SoC for v6.16

Sophgo:
 
 Add support for SG2044 TOP syscon device. The SG2044 TOP
 device provide PLL clock function in its area.
 
 Add RTC support for CV1800 series SoC. The device
 is called RTC, but contains control registers of other
 HW blocks in its address space, most notably of
 Power-on-Reset (PoR) module, DW8051 IP (MCU core),
 accompanying SRAM, hence putting it in SoC subsystem.
 
 Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEdoBX2jyDC9ZCTwZjDCzASqG0i0IFAmgkDx8ACgkQDCzASqG0
 i0KzNgwAuwEFXfJZYnWWraIx4+gr7v7tdjfnOz6qw/1Pp3B36R9DIgNe/dNkloGh
 ZXUw7wU6FmRu+VYvA9xIbrOjp5o+VEb9lRBIlQDOXtIGwSb3agMpCgein5XwbdrF
 78hfVZ95/2v/YkfIJsIWLG3S6t1XIZPiCBDKdZYSEBcXKXhtAINUm7BkO8JpLivS
 5a/lV9SYPGILXFou+ca5cgEov0BaIiA/OIJxKx5kylKBAidCRG+tmQcvz1TOGfim
 Kap0zjiaS6w+J7jPqIZT3lICk+24qXCrPDMObNCNov7tZMMw+bmCZntAEuleh5nu
 VEnigl5Wiuv+V6xo4m4yXzklMhq/y0ESOVSW12qGTRxh/Nvv9SlKfmjEyhTzugkb
 RcMojb5udrVeFdx7goT5LJwrkgc4P5ZbOZZXI2HouoU2+Ms8h0wr+LwQ2ls2v1Kr
 qiQ1Q0OB3n2elBz/AZ9zLXrLXumroestml/fFqd9ZqoqSyMiK/yJWL8IcH6uOx/R
 nKKwLcre
 =83uO
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmguDHQACgkQmmx57+YA
 GNm+Hw/7BYmkOJkpY51RrloRC+HMlJDs+oQJ+g0iii+FFh4Pfaxa6Lsgxmby0d+X
 J5LsERLMJ9TSWVfS3EQkhner4O+CxXqIZjnsu1sslDpYNXb9U3xTDLaDgHnFdt0P
 X7TThm92ZDJf8Z8E8Xec6zxIkJ/xfZByJZwjiTzCI2xOXjpINwZ6KCbJ9lne9cWW
 qoNJ3uPAqco2lgFhxvb5qnYIk3xf5NL0ZFa51rUfuMpIJtPVLab1A8ZgllXFDVqK
 7p3ayFaa5rMmJTgt/1gtpbOUKY+TvA9Ox6eMyoMvUHfG33pwSJTgW0IdbfFb74eg
 AYvuN1SL47XULhqz4Nmgc4msK63+3mVxcQUufc27O9Uu876wA/1ulLAjcFZZjzpU
 I7VBvlaBpPQmHkMiBODz5nrlpcfQld1VCxdIcHoP0v7Zsv5/93/EfFszEtm4tgkH
 S4rCP7YnWmot3IJsUXCZu+zd/tgULqBKKzaDuATYKidm/G9zWDBbgwzuZW2iUvFd
 1nXBXWRTHIizP0WzG2LsT0xIwt1XfXnEct2Zb1pPcp1uxaGzM6EBQ+AMdm+cPAW0
 UiYhi6Uv/86QEHDqU3WJ2iK9dtqmz965PTkzZGAy7AlkIeJdFqIflWVfAFjGF1Rs
 DW7M/nM55fGlWVO2WYZlPJlaXfzWxEeiMPkOMKIhW4ymay7uWoE=
 =yVfo
 -----END PGP SIGNATURE-----

Merge tag 'riscv-sophgo-soc-for-v6.16' of https://github.com/sophgo/linux into soc/drivers

RISC-V SoC for v6.16

Sophgo:

Add support for SG2044 TOP syscon device. The SG2044 TOP
device provide PLL clock function in its area.

Add RTC support for CV1800 series SoC. The device
is called RTC, but contains control registers of other
HW blocks in its address space, most notably of
Power-on-Reset (PoR) module, DW8051 IP (MCU core),
accompanying SRAM, hence putting it in SoC subsystem.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* tag 'riscv-sophgo-soc-for-v6.16' of https://github.com/sophgo/linux:
  soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
  dt-bindings: soc: sophgo: add RTC support for Sophgo CV1800 series
  soc: sophgo: sg2044: Add support for SG2044 TOP syscon device

Link: https://lore.kernel.org/r/MA0P287MB2262B041A26A0F5EAD1E296CFE91A@MA0P287MB2262.INDP287.PROD.OUTLOOK.COM
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
pull/1253/head
Arnd Bergmann 2025-05-21 19:25:07 +02:00
commit 6333f2974c
7 changed files with 234 additions and 0 deletions

View File

@ -0,0 +1,86 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sophgo/sophgo,cv1800b-rtc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Real Time Clock of the Sophgo CV1800 SoC
description:
The RTC (Real Time Clock) is an independently powered module in the chip. It
contains a 32KHz oscillator and a Power-On-Reset (POR) sub-module, which can
be used for time display and scheduled alarm produce. In addition, the
hardware state machine provides triggering and timing control for chip
power-on, power-off and reset.
Furthermore, the 8051 subsystem is located within RTCSYS and is independently
powered. System software can use the 8051 to manage wake conditions and wake
the system while the system is asleep, and communicate with external devices
through peripheral controllers.
Technical Reference Manual available at
https://github.com/sophgo/sophgo-doc/tree/main/SG200X/TRM
maintainers:
- sophgo@lists.linux.dev
allOf:
- $ref: /schemas/rtc/rtc.yaml#
properties:
compatible:
items:
- const: sophgo,cv1800b-rtc
- const: syscon
reg:
maxItems: 1
interrupts:
items:
- description: RTC Alarm
- description: RTC Longpress
- description: VBAT DET
interrupt-names:
items:
- const: alarm
- const: longpress
- const: vbat
clocks:
items:
- description: RTC clock source
- description: DW8051 MCU clock source
clock-names:
items:
- const: rtc
- const: mcu
required:
- compatible
- reg
- interrupts
- interrupt-names
- clocks
- clock-names
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/clock/sophgo,cv1800.h>
#include <dt-bindings/interrupt-controller/irq.h>
rtc@5025000 {
compatible = "sophgo,cv1800b-rtc", "syscon";
reg = <0x5025000 0x2000>;
interrupts = <17 IRQ_TYPE_LEVEL_HIGH>,
<18 IRQ_TYPE_LEVEL_HIGH>,
<19 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "alarm", "longpress", "vbat";
clocks = <&clk CLK_RTC_25M>,
<&clk CLK_SRC_RTC_SYS_0>;
clock-names = "rtc", "mcu";
};

View File

@ -23,6 +23,7 @@ source "drivers/soc/qcom/Kconfig"
source "drivers/soc/renesas/Kconfig"
source "drivers/soc/rockchip/Kconfig"
source "drivers/soc/samsung/Kconfig"
source "drivers/soc/sophgo/Kconfig"
source "drivers/soc/sunxi/Kconfig"
source "drivers/soc/tegra/Kconfig"
source "drivers/soc/ti/Kconfig"

View File

@ -29,6 +29,7 @@ obj-y += qcom/
obj-y += renesas/
obj-y += rockchip/
obj-$(CONFIG_SOC_SAMSUNG) += samsung/
obj-y += sophgo/
obj-y += sunxi/
obj-$(CONFIG_ARCH_TEGRA) += tegra/
obj-y += ti/

View File

@ -0,0 +1,34 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Sophgo SoC drivers
#
if ARCH_SOPHGO || COMPILE_TEST
menu "Sophgo SoC drivers"
config SOPHGO_CV1800_RTCSYS
tristate "Sophgo CV1800 RTC MFD"
select MFD_CORE
help
If you say yes here you get support the RTC MFD driver for Sophgo
CV1800 series SoC. The RTC module comprises a 32kHz oscillator,
Power-on-Reset (PoR) sub-module, HW state machine to control chip
power-on, power-off and reset. Furthermore, the 8051 subsystem is
located within RTCSYS including associated SRAM block.
This driver can also be built as a module. If so, the module will be
called cv1800-rtcsys.
config SOPHGO_SG2044_TOPSYS
tristate "Sophgo SG2044 TOP syscon driver"
select MFD_CORE
help
This is the core driver for the Sophgo SG2044 TOP system
controller device. This driver provide PLL clock device
for the SoC.
This driver can also be built as a module. If so, the module
will be called sg2044-topsys.
endmenu
endif

View File

@ -0,0 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_SOPHGO_CV1800_RTCSYS) += cv1800-rtcsys.o
obj-$(CONFIG_SOPHGO_SG2044_TOPSYS) += sg2044-topsys.o

View File

@ -0,0 +1,63 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for Sophgo CV1800 series SoC RTC subsystem
*
* The RTC module comprises a 32kHz oscillator, Power-on-Reset (PoR) sub-module,
* HW state machine to control chip power-on, power-off and reset. Furthermore,
* the 8051 subsystem is located within RTCSYS including associated SRAM block.
*
* Copyright (C) 2025 Alexander Sverdlin <alexander.sverdlin@gmail.com>
*
*/
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/property.h>
static struct resource cv1800_rtcsys_irq_resources[] = {
DEFINE_RES_IRQ_NAMED(0, "alarm"),
};
static const struct mfd_cell cv1800_rtcsys_subdev[] = {
{
.name = "cv1800b-rtc",
.num_resources = 1,
.resources = &cv1800_rtcsys_irq_resources[0],
},
};
static int cv1800_rtcsys_probe(struct platform_device *pdev)
{
int irq;
irq = platform_get_irq_byname(pdev, "alarm");
if (irq < 0)
return irq;
cv1800_rtcsys_irq_resources[0].start = irq;
cv1800_rtcsys_irq_resources[0].end = irq;
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
cv1800_rtcsys_subdev,
ARRAY_SIZE(cv1800_rtcsys_subdev),
NULL, 0, NULL);
}
static const struct of_device_id cv1800_rtcsys_of_match[] = {
{ .compatible = "sophgo,cv1800b-rtc" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, cv1800_rtcsys_of_match);
static struct platform_driver cv1800_rtcsys_mfd = {
.probe = cv1800_rtcsys_probe,
.driver = {
.name = "cv1800_rtcsys",
.of_match_table = cv1800_rtcsys_of_match,
},
};
module_platform_driver(cv1800_rtcsys_mfd);
MODULE_AUTHOR("Alexander Sverdlin <alexander.sverdlin@gmail.com>");
MODULE_DESCRIPTION("Sophgo CV1800 series SoC RTC subsystem driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,45 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Sophgo SG2044 multi-function system controller driver
*
* Copyright (C) 2025 Inochi Amaoto <inochiama@gmail.com>
*/
#include <linux/mfd/core.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/resource.h>
static const struct mfd_cell sg2044_topsys_subdev[] = {
{
.name = "sg2044-pll",
},
};
static int sg2044_topsys_probe(struct platform_device *pdev)
{
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
sg2044_topsys_subdev,
ARRAY_SIZE(sg2044_topsys_subdev),
NULL, 0, NULL);
}
static const struct of_device_id sg2044_topsys_of_match[] = {
{ .compatible = "sophgo,sg2044-top-syscon" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sg2044_topsys_of_match);
static struct platform_driver sg2044_topsys_driver = {
.probe = sg2044_topsys_probe,
.driver = {
.name = "sg2044-topsys",
.of_match_table = sg2044_topsys_of_match,
},
};
module_platform_driver(sg2044_topsys_driver);
MODULE_AUTHOR("Inochi Amaoto <inochiama@gmail.com>");
MODULE_DESCRIPTION("Sophgo SG2044 multi-function system controller driver");
MODULE_LICENSE("GPL");