Commit bb4ed26e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'newsoc-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull RISC-V SoC updates from Arnd Bergmann:
 "Add support for StarFive JH7100 RISC-V SoC

  This adds support for the StarFive JH7100, including the necessary
  device drivers and DT files for the BeagleV Starlight prototype board,
  with additional boards to be added later. This SoC promises to be the
  first usable low-cost platform for RISC-V.

  I've taken this through the SoC tree in the anticipation of adding a
  few other Arm based SoCs as well, but those did not pass the review in
  time, so it's only this one"

* tag 'newsoc-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
  reset: starfive-jh7100: Fix 32bit compilation
  RISC-V: Add BeagleV Starlight Beta device tree
  RISC-V: Add initial StarFive JH7100 device tree
  serial: 8250_dw: Add StarFive JH7100 quirk
  dt-bindings: serial: snps-dw-apb-uart: Add JH7100 uarts
  pinctrl: starfive: Add pinctrl driver for StarFive SoCs
  dt-bindings: pinctrl: Add StarFive JH7100 bindings
  dt-bindings: pinctrl: Add StarFive pinctrl definitions
  reset: starfive-jh7100: Add StarFive JH7100 reset driver
  dt-bindings: reset: Add Starfive JH7100 reset bindings
  dt-bindings: reset: Add StarFive JH7100 reset definitions
  clk: starfive: Add JH7100 clock generator driver
  dt-bindings: clock: starfive: Add JH7100 bindings
  dt-bindings: clock: starfive: Add JH7100 clock definitions
  dt-bindings: interrupt-controller: Add StarFive JH7100 plic
  dt-bindings: timer: Add StarFive JH7100 clint
  RISC-V: Add StarFive SoC Kconfig option
parents aca48b2d 299e6f78
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/starfive,jh7100-clkgen.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: StarFive JH7100 Clock Generator
maintainers:
- Geert Uytterhoeven <geert@linux-m68k.org>
- Emil Renner Berthing <kernel@esmil.dk>
properties:
compatible:
const: starfive,jh7100-clkgen
reg:
maxItems: 1
clocks:
items:
- description: Main clock source (25 MHz)
- description: Application-specific clock source (12-27 MHz)
- description: RMII reference clock (50 MHz)
- description: RGMII RX clock (125 MHz)
clock-names:
items:
- const: osc_sys
- const: osc_aud
- const: gmac_rmii_ref
- const: gmac_gr_mii_rxclk
'#clock-cells':
const: 1
description:
See <dt-bindings/clock/starfive-jh7100.h> for valid indices.
required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'
additionalProperties: false
examples:
- |
clock-controller@11800000 {
compatible = "starfive,jh7100-clkgen";
reg = <0x11800000 0x10000>;
clocks = <&osc_sys>, <&osc_aud>, <&gmac_rmii_ref>, <&gmac_gr_mii_rxclk>;
clock-names = "osc_sys", "osc_aud", "gmac_rmii_ref", "gmac_gr_mii_rxclk";
#clock-cells = <1>;
};
......@@ -45,6 +45,7 @@ properties:
items:
- enum:
- sifive,fu540-c000-plic
- starfive,jh7100-plic
- canaan,k210-plic
- const: sifive,plic-1.0.0
......
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/reset/starfive,jh7100-reset.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: StarFive JH7100 SoC Reset Controller Device Tree Bindings
maintainers:
- Emil Renner Berthing <kernel@esmil.dk>
properties:
compatible:
enum:
- starfive,jh7100-reset
reg:
maxItems: 1
"#reset-cells":
const: 1
required:
- compatible
- reg
- "#reset-cells"
additionalProperties: false
examples:
- |
reset-controller@11840000 {
compatible = "starfive,jh7100-reset";
reg = <0x11840000 0x10000>;
#reset-cells = <1>;
};
...
......@@ -40,6 +40,11 @@ properties:
- brcm,bcm11351-dw-apb-uart
- brcm,bcm21664-dw-apb-uart
- const: snps,dw-apb-uart
- items:
- enum:
- starfive,jh7100-hsuart
- starfive,jh7100-uart
- const: snps,dw-apb-uart
- const: snps,dw-apb-uart
reg:
......
......@@ -25,6 +25,7 @@ properties:
items:
- enum:
- sifive,fu540-c000-clint
- starfive,jh7100-clint
- canaan,k210-clint
- const: sifive,clint0
......
......@@ -18164,6 +18164,28 @@ M: Ion Badulescu <ionut@badula.org>
S: Odd Fixes
F: drivers/net/ethernet/adaptec/starfire*
STARFIVE JH7100 CLOCK DRIVER
M: Emil Renner Berthing <kernel@esmil.dk>
S: Maintained
F: Documentation/devicetree/bindings/clock/starfive,jh7100-clkgen.yaml
F: drivers/clk/starfive/clk-starfive-jh7100.c
F: include/dt-bindings/clock/starfive-jh7100.h
STARFIVE JH7100 PINCTRL DRIVER
M: Emil Renner Berthing <kernel@esmil.dk>
L: linux-gpio@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml
F: drivers/pinctrl/pinctrl-starfive.c
F: include/dt-bindings/pinctrl/pinctrl-starfive.h
STARFIVE JH7100 RESET CONTROLLER DRIVER
M: Emil Renner Berthing <kernel@esmil.dk>
S: Maintained
F: Documentation/devicetree/bindings/reset/starfive,jh7100-reset.yaml
F: drivers/reset/reset-starfive-jh7100.c
F: include/dt-bindings/reset/starfive-jh7100.h
STATIC BRANCH/CALL
M: Peter Zijlstra <peterz@infradead.org>
M: Josh Poimboeuf <jpoimboe@redhat.com>
......
......@@ -19,6 +19,14 @@ config SOC_SIFIVE
help
This enables support for SiFive SoC platform hardware.
config SOC_STARFIVE
bool "StarFive SoCs"
select PINCTRL
select RESET_CONTROLLER
select SIFIVE_PLIC
help
This enables support for StarFive SoC platform hardware.
config SOC_VIRT
bool "QEMU Virt Machine"
select CLINT_TIMER if RISCV_M_MODE
......
# SPDX-License-Identifier: GPL-2.0
subdir-y += sifive
subdir-y += starfive
subdir-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += canaan
subdir-y += microchip
......
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_SOC_STARFIVE) += jh7100-beaglev-starlight.dtb
// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Copyright (C) 2021 StarFive Technology Co., Ltd.
* Copyright (C) 2021 Emil Renner Berthing <kernel@esmil.dk>
*/
/dts-v1/;
#include "jh7100.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/pinctrl-starfive.h>
/ {
model = "BeagleV Starlight Beta";
compatible = "beagle,beaglev-starlight-jh7100-r0", "starfive,jh7100";
aliases {
serial0 = &uart3;
};
chosen {
stdout-path = "serial0:115200n8";
};
cpus {
timebase-frequency = <6250000>;
};
memory@80000000 {
device_type = "memory";
reg = <0x0 0x80000000 0x2 0x0>;
};
leds {
compatible = "gpio-leds";
led-ack {
gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_HEARTBEAT;
linux,default-trigger = "heartbeat";
label = "ack";
};
};
};
&gpio {
i2c0_pins: i2c0-0 {
i2c-pins {
pinmux = <GPIOMUX(62, GPO_LOW,
GPO_I2C0_PAD_SCK_OEN,
GPI_I2C0_PAD_SCK_IN)>,
<GPIOMUX(61, GPO_LOW,
GPO_I2C0_PAD_SDA_OEN,
GPI_I2C0_PAD_SDA_IN)>;
bias-disable; /* external pull-up */
input-enable;
input-schmitt-enable;
};
};
i2c1_pins: i2c1-0 {
i2c-pins {
pinmux = <GPIOMUX(47, GPO_LOW,
GPO_I2C1_PAD_SCK_OEN,
GPI_I2C1_PAD_SCK_IN)>,
<GPIOMUX(48, GPO_LOW,
GPO_I2C1_PAD_SDA_OEN,
GPI_I2C1_PAD_SDA_IN)>;
bias-pull-up;
input-enable;
input-schmitt-enable;
};
};
i2c2_pins: i2c2-0 {
i2c-pins {
pinmux = <GPIOMUX(60, GPO_LOW,
GPO_I2C2_PAD_SCK_OEN,
GPI_I2C2_PAD_SCK_IN)>,
<GPIOMUX(59, GPO_LOW,
GPO_I2C2_PAD_SDA_OEN,
GPI_I2C2_PAD_SDA_IN)>;
bias-disable; /* external pull-up */
input-enable;
input-schmitt-enable;
};
};
uart3_pins: uart3-0 {
rx-pins {
pinmux = <GPIOMUX(13, GPO_LOW, GPO_DISABLE,
GPI_UART3_PAD_SIN)>;
bias-pull-up;
drive-strength = <14>;
input-enable;
input-schmitt-enable;
slew-rate = <0>;
};
tx-pins {
pinmux = <GPIOMUX(14, GPO_UART3_PAD_SOUT,
GPO_ENABLE, GPI_NONE)>;
bias-disable;
drive-strength = <35>;
input-disable;
input-schmitt-disable;
slew-rate = <0>;
};
};
};
&i2c0 {
clock-frequency = <100000>;
i2c-sda-hold-time-ns = <300>;
i2c-sda-falling-time-ns = <500>;
i2c-scl-falling-time-ns = <500>;
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "okay";
pmic@5e {
compatible = "ti,tps65086";
reg = <0x5e>;
gpio-controller;
#gpio-cells = <2>;
regulators {
};
};
};
&i2c1 {
clock-frequency = <400000>;
i2c-sda-hold-time-ns = <300>;
i2c-sda-falling-time-ns = <100>;
i2c-scl-falling-time-ns = <100>;
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
i2c-sda-hold-time-ns = <300>;
i2c-sda-falling-time-ns = <500>;
i2c-scl-falling-time-ns = <500>;
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins>;
status = "okay";
};
&osc_sys {
clock-frequency = <25000000>;
};
&osc_aud {
clock-frequency = <27000000>;
};
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
status = "okay";
};
// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Copyright (C) 2021 StarFive Technology Co., Ltd.
* Copyright (C) 2021 Emil Renner Berthing <kernel@esmil.dk>
*/
/dts-v1/;
#include <dt-bindings/clock/starfive-jh7100.h>
#include <dt-bindings/reset/starfive-jh7100.h>
/ {
compatible = "starfive,jh7100";
#address-cells = <2>;
#size-cells = <2>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "sifive,u74-mc", "riscv";
reg = <0>;
d-cache-block-size = <64>;
d-cache-sets = <64>;
d-cache-size = <32768>;
d-tlb-sets = <1>;
d-tlb-size = <32>;
device_type = "cpu";
i-cache-block-size = <64>;
i-cache-sets = <64>;
i-cache-size = <32768>;
i-tlb-sets = <1>;
i-tlb-size = <32>;
mmu-type = "riscv,sv39";
riscv,isa = "rv64imafdc";
tlb-split;
cpu0_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
interrupt-controller;
#interrupt-cells = <1>;
};
};
cpu@1 {
compatible = "sifive,u74-mc", "riscv";
reg = <1>;
d-cache-block-size = <64>;
d-cache-sets = <64>;
d-cache-size = <32768>;
d-tlb-sets = <1>;
d-tlb-size = <32>;
device_type = "cpu";
i-cache-block-size = <64>;
i-cache-sets = <64>;
i-cache-size = <32768>;
i-tlb-sets = <1>;
i-tlb-size = <32>;
mmu-type = "riscv,sv39";
riscv,isa = "rv64imafdc";
tlb-split;
cpu1_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
interrupt-controller;
#interrupt-cells = <1>;
};
};
};
osc_sys: osc_sys {
compatible = "fixed-clock";
#clock-cells = <0>;
/* This value must be overridden by the board */
clock-frequency = <0>;
};
osc_aud: osc_aud {
compatible = "fixed-clock";
#clock-cells = <0>;
/* This value must be overridden by the board */
clock-frequency = <0>;
};
gmac_rmii_ref: gmac_rmii_ref {
compatible = "fixed-clock";
#clock-cells = <0>;
/* Should be overridden by the board when needed */
clock-frequency = <0>;
};
gmac_gr_mii_rxclk: gmac_gr_mii_rxclk {
compatible = "fixed-clock";
#clock-cells = <0>;
/* Should be overridden by the board when needed */
clock-frequency = <0>;
};
soc {
compatible = "simple-bus";
interrupt-parent = <&plic>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
clint: clint@2000000 {
compatible = "starfive,jh7100-clint", "sifive,clint0";
reg = <0x0 0x2000000 0x0 0x10000>;
interrupts-extended = <&cpu0_intc 3 &cpu0_intc 7
&cpu1_intc 3 &cpu1_intc 7>;
};
plic: interrupt-controller@c000000 {
compatible = "starfive,jh7100-plic", "sifive,plic-1.0.0";
reg = <0x0 0xc000000 0x0 0x4000000>;
interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9
&cpu1_intc 11 &cpu1_intc 9>;
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <1>;
riscv,ndev = <127>;
};
clkgen: clock-controller@11800000 {
compatible = "starfive,jh7100-clkgen";
reg = <0x0 0x11800000 0x0 0x10000>;
clocks = <&osc_sys>, <&osc_aud>, <&gmac_rmii_ref>, <&gmac_gr_mii_rxclk>;
clock-names = "osc_sys", "osc_aud", "gmac_rmii_ref", "gmac_gr_mii_rxclk";
#clock-cells = <1>;
};
rstgen: reset-controller@11840000 {
compatible = "starfive,jh7100-reset";
reg = <0x0 0x11840000 0x0 0x10000>;
#reset-cells = <1>;
};
i2c0: i2c@118b0000 {
compatible = "snps,designware-i2c";
reg = <0x0 0x118b0000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_I2C0_CORE>,
<&clkgen JH7100_CLK_I2C0_APB>;
clock-names = "ref", "pclk";
resets = <&rstgen JH7100_RSTN_I2C0_APB>;
interrupts = <96>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
i2c1: i2c@118c0000 {
compatible = "snps,designware-i2c";
reg = <0x0 0x118c0000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_I2C1_CORE>,
<&clkgen JH7100_CLK_I2C1_APB>;
clock-names = "ref", "pclk";
resets = <&rstgen JH7100_RSTN_I2C1_APB>;
interrupts = <97>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
gpio: pinctrl@11910000 {
compatible = "starfive,jh7100-pinctrl";
reg = <0x0 0x11910000 0x0 0x10000>,
<0x0 0x11858000 0x0 0x1000>;
reg-names = "gpio", "padctl";
clocks = <&clkgen JH7100_CLK_GPIO_APB>;
resets = <&rstgen JH7100_RSTN_GPIO_APB>;
interrupts = <32>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
};
uart2: serial@12430000 {
compatible = "starfive,jh7100-uart", "snps,dw-apb-uart";
reg = <0x0 0x12430000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_UART2_CORE>,
<&clkgen JH7100_CLK_UART2_APB>;
clock-names = "baudclk", "apb_pclk";
resets = <&rstgen JH7100_RSTN_UART2_APB>;
interrupts = <72>;
reg-io-width = <4>;
reg-shift = <2>;
status = "disabled";
};
uart3: serial@12440000 {
compatible = "starfive,jh7100-uart", "snps,dw-apb-uart";
reg = <0x0 0x12440000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_UART3_CORE>,
<&clkgen JH7100_CLK_UART3_APB>;
clock-names = "baudclk", "apb_pclk";
resets = <&rstgen JH7100_RSTN_UART3_APB>;
interrupts = <73>;
reg-io-width = <4>;
reg-shift = <2>;
status = "disabled";
};
i2c2: i2c@12450000 {
compatible = "snps,designware-i2c";
reg = <0x0 0x12450000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_I2C2_CORE>,
<&clkgen JH7100_CLK_I2C2_APB>;
clock-names = "ref", "pclk";
resets = <&rstgen JH7100_RSTN_I2C2_APB>;
interrupts = <74>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
i2c3: i2c@12460000 {
compatible = "snps,designware-i2c";
reg = <0x0 0x12460000 0x0 0x10000>;
clocks = <&clkgen JH7100_CLK_I2C3_CORE>,
<&clkgen JH7100_CLK_I2C3_APB>;
clock-names = "ref", "pclk";
resets = <&rstgen JH7100_RSTN_I2C3_APB>;
interrupts = <75>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
};
};
......@@ -412,6 +412,7 @@ source "drivers/clk/samsung/Kconfig"
source "drivers/clk/sifive/Kconfig"
source "drivers/clk/socfpga/Kconfig"
source "drivers/clk/sprd/Kconfig"
source "drivers/clk/starfive/Kconfig"
source "drivers/clk/sunxi/Kconfig"
source "drivers/clk/sunxi-ng/Kconfig"
source "drivers/clk/tegra/Kconfig"
......
......@@ -109,6 +109,7 @@ obj-y += socfpga/
obj-$(CONFIG_PLAT_SPEAR) += spear/
obj-y += sprd/
obj-$(CONFIG_ARCH_STI) += st/
obj-$(CONFIG_SOC_STARFIVE) += starfive/
obj-$(CONFIG_ARCH_SUNXI) += sunxi/
obj-$(CONFIG_SUNXI_CCU) += sunxi-ng/
obj-$(CONFIG_ARCH_TEGRA) += tegra/
......
# SPDX-License-Identifier: GPL-2.0
config CLK_STARFIVE_JH7100
bool "StarFive JH7100 clock support"
depends on SOC_STARFIVE || COMPILE_TEST
default SOC_STARFIVE
help
Say yes here to support the clock controller on the StarFive JH7100
SoC.
# SPDX-License-Identifier: GPL-2.0
# StarFive Clock
obj-$(CONFIG_CLK_STARFIVE_JH7100) += clk-starfive-jh7100.o
This diff is collapsed.
......@@ -281,6 +281,23 @@ config PINCTRL_ST
select PINCONF
select GPIOLIB_IRQCHIP
config PINCTRL_STARFIVE
tristate "Pinctrl and GPIO driver for the StarFive JH7100 SoC"
depends on SOC_STARFIVE || COMPILE_TEST
depends on OF
default SOC_STARFIVE
select GENERIC_PINCTRL_GROUPS
select GENERIC_PINMUX_FUNCTIONS
select GENERIC_PINCONF
select GPIOLIB
select GPIOLIB_IRQCHIP
select OF_GPIO
help
Say yes here to support pin control on the StarFive JH7100 SoC.
This also provides an interface to the GPIO pins not used by other
peripherals supporting inputs, outputs, configuring pull-up/pull-down
and interrupts on input changes.
config PINCTRL_STMFX
tristate "STMicroelectronics STMFX GPIO expander pinctrl driver"
depends on I2C
......
......@@ -39,6 +39,7 @@ obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o
obj-$(CONFIG_PINCTRL_LPC18XX) += pinctrl-lpc18xx.o
obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o
obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o
obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o
obj-$(CONFIG_PINCTRL_ZYNQMP) += pinctrl-zynqmp.o
......
This diff is collapsed.
......@@ -224,6 +224,13 @@ config RESET_SOCFPGA
This enables the reset driver for the SoCFPGA ARMv7 platforms. This
driver gets initialized early during platform init calls.
config RESET_STARFIVE_JH7100
bool "StarFive JH7100 Reset Driver"
depends on SOC_STARFIVE || COMPILE_TEST
default SOC_STARFIVE
help
This enables the reset controller driver for the StarFive JH7100 SoC.
config RESET_SUNXI
bool "Allwinner SoCs Reset Driver" if COMPILE_TEST && !ARCH_SUNXI
default ARCH_SUNXI
......
......@@ -29,6 +29,7 @@ obj-$(CONFIG_RESET_RZG2L_USBPHY_CTRL) += reset-rzg2l-usbphy-ctrl.o
obj-$(CONFIG_RESET_SCMI) += reset-scmi.o
obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_RESET_STARFIVE_JH7100) += reset-starfive-jh7100.o
obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
......
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Reset driver for the StarFive JH7100 SoC
*
* Copyright (C) 2021 Emil Renner Berthing <kernel@esmil.dk>
*/
#include <linux/bitmap.h>
#include <linux/io.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/iopoll.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/reset-controller.h>
#include <linux/spinlock.h>
#include <dt-bindings/reset/starfive-jh7100.h>
/* register offsets */
#define JH7100_RESET_ASSERT0 0x00
#define JH7100_RESET_ASSERT1 0x04
#define JH7100_RESET_ASSERT2 0x08
#define JH7100_RESET_ASSERT3 0x0c
#define JH7100_RESET_STATUS0 0x10
#define JH7100_RESET_STATUS1 0x14
#define JH7100_RESET_STATUS2 0x18
#define JH7100_RESET_STATUS3 0x1c
/*
* Writing a 1 to the n'th bit of the m'th ASSERT register asserts
* line 32m + n, and writing a 0 deasserts the same line.
* Most reset lines have their status inverted so a 0 bit in the STATUS
* register means the line is asserted and a 1 means it's deasserted. A few
* lines don't though, so store the expected value of the status registers when
* all lines are asserted.
*/
static const u64 jh7100_reset_asserted[2] = {
/* STATUS0 */
BIT_ULL_MASK(JH7100_RST_U74) |
BIT_ULL_MASK(JH7100_RST_VP6_DRESET) |
BIT_ULL_MASK(JH7100_RST_VP6_BRESET) |
/* STATUS1 */
BIT_ULL_MASK(JH7100_RST_HIFI4_DRESET) |
BIT_ULL_MASK(JH7100_RST_HIFI4_BRESET),
/* STATUS2 */
BIT_ULL_MASK(JH7100_RST_E24) |
/* STATUS3 */
0,
};
struct jh7100_reset {
struct reset_controller_dev rcdev;
/* protect registers against concurrent read-modify-write */
spinlock_t lock;
void __iomem *base;
};
static inline struct jh7100_reset *
jh7100_reset_from(struct reset_controller_dev *rcdev)
{
return container_of(rcdev, struct jh7100_reset, rcdev);
}
static int jh7100_reset_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
struct jh7100_reset *data = jh7100_reset_from(rcdev);
unsigned long offset = BIT_ULL_WORD(id);
u64 mask = BIT_ULL_MASK(id);
void __iomem *reg_assert = data->base + JH7100_RESET_ASSERT0 + offset * sizeof(u64);
void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + offset * sizeof(u64);
u64 done = jh7100_reset_asserted[offset] & mask;
u64 value;
unsigned long flags;
int ret;
if (!assert)
done ^= mask;
spin_lock_irqsave(&data->lock, flags);
value = readq(reg_assert);
if (assert)
value |= mask;
else
value &= ~mask;
writeq(value, reg_assert);
/* if the associated clock is gated, deasserting might otherwise hang forever */
ret = readq_poll_timeout_atomic(reg_status, value, (value & mask) == done, 0, 1000);
spin_unlock_irqrestore(&data->lock, flags);
return ret;
}
static int jh7100_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return jh7100_reset_update(rcdev, id, true);
}
static int jh7100_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return jh7100_reset_update(rcdev, id, false);
}
static int jh7100_reset_reset(struct reset_controller_dev *rcdev,
unsigned long id)
{
int ret;
ret = jh7100_reset_assert(rcdev, id);
if (ret)
return ret;
return jh7100_reset_deassert(rcdev, id);
}
static int jh7100_reset_status(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct jh7100_reset *data = jh7100_reset_from(rcdev);
unsigned long offset = BIT_ULL_WORD(id);
u64 mask = BIT_ULL_MASK(id);
void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + offset * sizeof(u64);
u64 value = readq(reg_status);
return !((value ^ jh7100_reset_asserted[offset]) & mask);
}
static const struct reset_control_ops jh7100_reset_ops = {
.assert = jh7100_reset_assert,
.deassert = jh7100_reset_deassert,
.reset = jh7100_reset_reset,
.status = jh7100_reset_status,
};
static int __init jh7100_reset_probe(struct platform_device *pdev)
{
struct jh7100_reset *data;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->base))
return PTR_ERR(data->base);
data->rcdev.ops = &jh7100_reset_ops;
data->rcdev.owner = THIS_MODULE;
data->rcdev.nr_resets = JH7100_RSTN_END;
data->rcdev.dev = &pdev->dev;
data->rcdev.of_node = pdev->dev.of_node;
spin_lock_init(&data->lock);
return devm_reset_controller_register(&pdev->dev, &data->rcdev);
}
static const struct of_device_id jh7100_reset_dt_ids[] = {
{ .compatible = "starfive,jh7100-reset" },
{ /* sentinel */ }
};
static struct platform_driver jh7100_reset_driver = {
.driver = {
.name = "jh7100-reset",
.of_match_table = jh7100_reset_dt_ids,
.suppress_bind_attrs = true,
},
};
builtin_platform_driver_probe(jh7100_reset_driver, jh7100_reset_probe);
......@@ -414,6 +414,8 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
if (of_device_is_compatible(np, "marvell,armada-38x-uart"))
p->serial_out = dw8250_serial_out38x;
if (of_device_is_compatible(np, "starfive,jh7100-uart"))
p->set_termios = dw8250_do_set_termios;
} else if (acpi_dev_present("APMC0D08", NULL, -1)) {
p->iotype = UPIO_MEM32;
......@@ -696,6 +698,7 @@ static const struct of_device_id dw8250_of_match[] = {
{ .compatible = "cavium,octeon-3860-uart" },
{ .compatible = "marvell,armada-38x-uart" },
{ .compatible = "renesas,rzn1-uart" },
{ .compatible = "starfive,jh7100-uart" },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, dw8250_of_match);
......
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/*
* Copyright (C) 2021 Ahmad Fatoum, Pengutronix
*/
#ifndef __DT_BINDINGS_CLOCK_STARFIVE_JH7100_H__
#define __DT_BINDINGS_CLOCK_STARFIVE_JH7100_H__
#define JH7100_CLK_CPUNDBUS_ROOT 0
#define JH7100_CLK_DLA_ROOT 1
#define JH7100_CLK_DSP_ROOT 2
#define JH7100_CLK_GMACUSB_ROOT 3
#define JH7100_CLK_PERH0_ROOT 4
#define JH7100_CLK_PERH1_ROOT 5
#define JH7100_CLK_VIN_ROOT 6
#define JH7100_CLK_VOUT_ROOT 7
#define JH7100_CLK_AUDIO_ROOT 8
#define JH7100_CLK_CDECHIFI4_ROOT 9
#define JH7100_CLK_CDEC_ROOT 10
#define JH7100_CLK_VOUTBUS_ROOT 11
#define JH7100_CLK_CPUNBUS_ROOT_DIV 12
#define JH7100_CLK_DSP_ROOT_DIV 13
#define JH7100_CLK_PERH0_SRC 14
#define JH7100_CLK_PERH1_SRC 15
#define JH7100_CLK_PLL0_TESTOUT 16
#define JH7100_CLK_PLL1_TESTOUT 17
#define JH7100_CLK_PLL2_TESTOUT 18
#define JH7100_CLK_PLL2_REF 19
#define JH7100_CLK_CPU_CORE 20
#define JH7100_CLK_CPU_AXI 21
#define JH7100_CLK_AHB_BUS 22
#define JH7100_CLK_APB1_BUS 23
#define JH7100_CLK_APB2_BUS 24
#define JH7100_CLK_DOM3AHB_BUS 25
#define JH7100_CLK_DOM7AHB_BUS 26
#define JH7100_CLK_U74_CORE0 27
#define JH7100_CLK_U74_CORE1 28
#define JH7100_CLK_U74_AXI 29
#define JH7100_CLK_U74RTC_TOGGLE 30
#define JH7100_CLK_SGDMA2P_AXI 31
#define JH7100_CLK_DMA2PNOC_AXI 32
#define JH7100_CLK_SGDMA2P_AHB 33
#define JH7100_CLK_DLA_BUS 34
#define JH7100_CLK_DLA_AXI 35
#define JH7100_CLK_DLANOC_AXI 36
#define JH7100_CLK_DLA_APB 37
#define JH7100_CLK_VP6_CORE 38
#define JH7100_CLK_VP6BUS_SRC 39
#define JH7100_CLK_VP6_AXI 40
#define JH7100_CLK_VCDECBUS_SRC 41
#define JH7100_CLK_VDEC_BUS 42
#define JH7100_CLK_VDEC_AXI 43
#define JH7100_CLK_VDECBRG_MAIN 44
#define JH7100_CLK_VDEC_BCLK 45
#define JH7100_CLK_VDEC_CCLK 46
#define JH7100_CLK_VDEC_APB 47
#define JH7100_CLK_JPEG_AXI 48
#define JH7100_CLK_JPEG_CCLK 49
#define JH7100_CLK_JPEG_APB 50
#define JH7100_CLK_GC300_2X 51
#define JH7100_CLK_GC300_AHB 52
#define JH7100_CLK_JPCGC300_AXIBUS 53
#define JH7100_CLK_GC300_AXI 54
#define JH7100_CLK_JPCGC300_MAIN 55
#define JH7100_CLK_VENC_BUS 56
#define JH7100_CLK_VENC_AXI 57
#define JH7100_CLK_VENCBRG_MAIN 58
#define JH7100_CLK_VENC_BCLK 59
#define JH7100_CLK_VENC_CCLK 60
#define JH7100_CLK_VENC_APB 61
#define JH7100_CLK_DDRPLL_DIV2 62
#define JH7100_CLK_DDRPLL_DIV4 63
#define JH7100_CLK_DDRPLL_DIV8 64
#define JH7100_CLK_DDROSC_DIV2 65
#define JH7100_CLK_DDRC0 66
#define JH7100_CLK_DDRC1 67
#define JH7100_CLK_DDRPHY_APB 68
#define JH7100_CLK_NOC_ROB 69
#define JH7100_CLK_NOC_COG 70
#define JH7100_CLK_NNE_AHB 71
#define JH7100_CLK_NNEBUS_SRC1 72
#define JH7100_CLK_NNE_BUS 73
#define JH7100_CLK_NNE_AXI 74
#define JH7100_CLK_NNENOC_AXI 75
#define JH7100_CLK_DLASLV_AXI 76
#define JH7100_CLK_DSPX2C_AXI 77
#define JH7100_CLK_HIFI4_SRC 78
#define JH7100_CLK_HIFI4_COREFREE 79
#define JH7100_CLK_HIFI4_CORE 80
#define JH7100_CLK_HIFI4_BUS 81
#define JH7100_CLK_HIFI4_AXI 82
#define JH7100_CLK_HIFI4NOC_AXI 83
#define JH7100_CLK_SGDMA1P_BUS 84
#define JH7100_CLK_SGDMA1P_AXI 85
#define JH7100_CLK_DMA1P_AXI 86
#define JH7100_CLK_X2C_AXI 87
#define JH7100_CLK_USB_BUS 88
#define JH7100_CLK_USB_AXI 89
#define JH7100_CLK_USBNOC_AXI 90
#define JH7100_CLK_USBPHY_ROOTDIV 91
#define JH7100_CLK_USBPHY_125M 92
#define JH7100_CLK_USBPHY_PLLDIV25M 93
#define JH7100_CLK_USBPHY_25M 94
#define JH7100_CLK_AUDIO_DIV 95
#define JH7100_CLK_AUDIO_SRC 96
#define JH7100_CLK_AUDIO_12288 97
#define JH7100_CLK_VIN_SRC 98
#define JH7100_CLK_ISP0_BUS 99
#define JH7100_CLK_ISP0_AXI 100
#define JH7100_CLK_ISP0NOC_AXI 101
#define JH7100_CLK_ISPSLV_AXI 102
#define JH7100_CLK_ISP1_BUS 103
#define JH7100_CLK_ISP1_AXI 104
#define JH7100_CLK_ISP1NOC_AXI 105
#define JH7100_CLK_VIN_BUS 106
#define JH7100_CLK_VIN_AXI 107
#define JH7100_CLK_VINNOC_AXI 108
#define JH7100_CLK_VOUT_SRC 109
#define JH7100_CLK_DISPBUS_SRC 110
#define JH7100_CLK_DISP_BUS 111
#define JH7100_CLK_DISP_AXI 112
#define JH7100_CLK_DISPNOC_AXI 113
#define JH7100_CLK_SDIO0_AHB 114
#define JH7100_CLK_SDIO0_CCLKINT 115
#define JH7100_CLK_SDIO0_CCLKINT_INV 116
#define JH7100_CLK_SDIO1_AHB 117
#define JH7100_CLK_SDIO1_CCLKINT 118
#define JH7100_CLK_SDIO1_CCLKINT_INV 119
#define JH7100_CLK_GMAC_AHB 120
#define JH7100_CLK_GMAC_ROOT_DIV 121
#define JH7100_CLK_GMAC_PTP_REF 122
#define JH7100_CLK_GMAC_GTX 123
#define JH7100_CLK_GMAC_RMII_TX 124
#define JH7100_CLK_GMAC_RMII_RX 125
#define JH7100_CLK_GMAC_TX 126
#define JH7100_CLK_GMAC_TX_INV 127
#define JH7100_CLK_GMAC_RX_PRE 128
#define JH7100_CLK_GMAC_RX_INV 129
#define JH7100_CLK_GMAC_RMII 130
#define JH7100_CLK_GMAC_TOPHYREF 131
#define JH7100_CLK_SPI2AHB_AHB 132
#define JH7100_CLK_SPI2AHB_CORE 133
#define JH7100_CLK_EZMASTER_AHB 134
#define JH7100_CLK_E24_AHB 135
#define JH7100_CLK_E24RTC_TOGGLE 136
#define JH7100_CLK_QSPI_AHB 137
#define JH7100_CLK_QSPI_APB 138
#define JH7100_CLK_QSPI_REF 139
#define JH7100_CLK_SEC_AHB 140
#define JH7100_CLK_AES 141
#define JH7100_CLK_SHA 142
#define JH7100_CLK_PKA 143
#define JH7100_CLK_TRNG_APB 144
#define JH7100_CLK_OTP_APB 145
#define JH7100_CLK_UART0_APB 146
#define JH7100_CLK_UART0_CORE 147
#define JH7100_CLK_UART1_APB 148
#define JH7100_CLK_UART1_CORE 149
#define JH7100_CLK_SPI0_APB 150
#define JH7100_CLK_SPI0_CORE 151
#define JH7100_CLK_SPI1_APB 152
#define JH7100_CLK_SPI1_CORE 153
#define JH7100_CLK_I2C0_APB 154
#define JH7100_CLK_I2C0_CORE 155
#define JH7100_CLK_I2C1_APB 156
#define JH7100_CLK_I2C1_CORE 157
#define JH7100_CLK_GPIO_APB 158
#define JH7100_CLK_UART2_APB 159
#define JH7100_CLK_UART2_CORE 160
#define JH7100_CLK_UART3_APB 161
#define JH7100_CLK_UART3_CORE 162
#define JH7100_CLK_SPI2_APB 163
#define JH7100_CLK_SPI2_CORE 164
#define JH7100_CLK_SPI3_APB 165
#define JH7100_CLK_SPI3_CORE 166
#define JH7100_CLK_I2C2_APB 167
#define JH7100_CLK_I2C2_CORE 168
#define JH7100_CLK_I2C3_APB 169
#define JH7100_CLK_I2C3_CORE 170
#define JH7100_CLK_WDTIMER_APB 171
#define JH7100_CLK_WDT_CORE 172
#define JH7100_CLK_TIMER0_CORE 173
#define JH7100_CLK_TIMER1_CORE 174
#define JH7100_CLK_TIMER2_CORE 175
#define JH7100_CLK_TIMER3_CORE 176
#define JH7100_CLK_TIMER4_CORE 177
#define JH7100_CLK_TIMER5_CORE 178
#define JH7100_CLK_TIMER6_CORE 179
#define JH7100_CLK_VP6INTC_APB 180
#define JH7100_CLK_PWM_APB 181
#define JH7100_CLK_MSI_APB 182
#define JH7100_CLK_TEMP_APB 183
#define JH7100_CLK_TEMP_SENSE 184
#define JH7100_CLK_SYSERR_APB 185
#define JH7100_CLK_PLL0_OUT 186
#define JH7100_CLK_PLL1_OUT 187
#define JH7100_CLK_PLL2_OUT 188
#define JH7100_CLK_END 189
#endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH7100_H__ */
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/*
* Copyright (C) 2021 Ahmad Fatoum, Pengutronix
*/
#ifndef __DT_BINDINGS_RESET_STARFIVE_JH7100_H__
#define __DT_BINDINGS_RESET_STARFIVE_JH7100_H__
#define JH7100_RSTN_DOM3AHB_BUS 0
#define JH7100_RSTN_DOM7AHB_BUS 1
#define JH7100_RST_U74 2
#define JH7100_RSTN_U74_AXI 3
#define JH7100_RSTN_SGDMA2P_AHB 4
#define JH7100_RSTN_SGDMA2P_AXI 5
#define JH7100_RSTN_DMA2PNOC_AXI 6
#define JH7100_RSTN_DLA_AXI 7
#define JH7100_RSTN_DLANOC_AXI 8
#define JH7100_RSTN_DLA_APB 9
#define JH7100_RST_VP6_DRESET 10
#define JH7100_RST_VP6_BRESET 11
#define JH7100_RSTN_VP6_AXI 12
#define JH7100_RSTN_VDECBRG_MAIN 13
#define JH7100_RSTN_VDEC_AXI 14
#define JH7100_RSTN_VDEC_BCLK 15
#define JH7100_RSTN_VDEC_CCLK 16
#define JH7100_RSTN_VDEC_APB 17
#define JH7100_RSTN_JPEG_AXI 18
#define JH7100_RSTN_JPEG_CCLK 19
#define JH7100_RSTN_JPEG_APB 20
#define JH7100_RSTN_JPCGC300_MAIN 21
#define JH7100_RSTN_GC300_2X 22
#define JH7100_RSTN_GC300_AXI 23
#define JH7100_RSTN_GC300_AHB 24
#define JH7100_RSTN_VENC_AXI 25
#define JH7100_RSTN_VENCBRG_MAIN 26
#define JH7100_RSTN_VENC_BCLK 27
#define JH7100_RSTN_VENC_CCLK 28
#define JH7100_RSTN_VENC_APB 29
#define JH7100_RSTN_DDRPHY_APB 30
#define JH7100_RSTN_NOC_ROB 31
#define JH7100_RSTN_NOC_COG 32
#define JH7100_RSTN_HIFI4_AXI 33
#define JH7100_RSTN_HIFI4NOC_AXI 34
#define JH7100_RST_HIFI4_DRESET 35
#define JH7100_RST_HIFI4_BRESET 36
#define JH7100_RSTN_USB_AXI 37
#define JH7100_RSTN_USBNOC_AXI 38
#define JH7100_RSTN_SGDMA1P_AXI 39
#define JH7100_RSTN_DMA1P_AXI 40
#define JH7100_RSTN_X2C_AXI 41
#define JH7100_RSTN_NNE_AHB 42
#define JH7100_RSTN_NNE_AXI 43
#define JH7100_RSTN_NNENOC_AXI 44
#define JH7100_RSTN_DLASLV_AXI 45
#define JH7100_RSTN_DSPX2C_AXI 46
#define JH7100_RSTN_VIN_SRC 47
#define JH7100_RSTN_ISPSLV_AXI 48
#define JH7100_RSTN_VIN_AXI 49
#define JH7100_RSTN_VINNOC_AXI 50
#define JH7100_RSTN_ISP0_AXI 51
#define JH7100_RSTN_ISP0NOC_AXI 52
#define JH7100_RSTN_ISP1_AXI 53
#define JH7100_RSTN_ISP1NOC_AXI 54
#define JH7100_RSTN_VOUT_SRC 55
#define JH7100_RSTN_DISP_AXI 56
#define JH7100_RSTN_DISPNOC_AXI 57
#define JH7100_RSTN_SDIO0_AHB 58
#define JH7100_RSTN_SDIO1_AHB 59
#define JH7100_RSTN_GMAC_AHB 60
#define JH7100_RSTN_SPI2AHB_AHB 61
#define JH7100_RSTN_SPI2AHB_CORE 62
#define JH7100_RSTN_EZMASTER_AHB 63
#define JH7100_RST_E24 64
#define JH7100_RSTN_QSPI_AHB 65
#define JH7100_RSTN_QSPI_CORE 66
#define JH7100_RSTN_QSPI_APB 67
#define JH7100_RSTN_SEC_AHB 68
#define JH7100_RSTN_AES 69
#define JH7100_RSTN_PKA 70
#define JH7100_RSTN_SHA 71
#define JH7100_RSTN_TRNG_APB 72
#define JH7100_RSTN_OTP_APB 73
#define JH7100_RSTN_UART0_APB 74
#define JH7100_RSTN_UART0_CORE 75
#define JH7100_RSTN_UART1_APB 76
#define JH7100_RSTN_UART1_CORE 77
#define JH7100_RSTN_SPI0_APB 78
#define JH7100_RSTN_SPI0_CORE 79
#define JH7100_RSTN_SPI1_APB 80
#define JH7100_RSTN_SPI1_CORE 81
#define JH7100_RSTN_I2C0_APB 82
#define JH7100_RSTN_I2C0_CORE 83
#define JH7100_RSTN_I2C1_APB 84
#define JH7100_RSTN_I2C1_CORE 85
#define JH7100_RSTN_GPIO_APB 86
#define JH7100_RSTN_UART2_APB 87
#define JH7100_RSTN_UART2_CORE 88
#define JH7100_RSTN_UART3_APB 89
#define JH7100_RSTN_UART3_CORE 90
#define JH7100_RSTN_SPI2_APB 91
#define JH7100_RSTN_SPI2_CORE 92
#define JH7100_RSTN_SPI3_APB 93
#define JH7100_RSTN_SPI3_CORE 94
#define JH7100_RSTN_I2C2_APB 95
#define JH7100_RSTN_I2C2_CORE 96
#define JH7100_RSTN_I2C3_APB 97
#define JH7100_RSTN_I2C3_CORE 98
#define JH7100_RSTN_WDTIMER_APB 99
#define JH7100_RSTN_WDT 100
#define JH7100_RSTN_TIMER0 101
#define JH7100_RSTN_TIMER1 102
#define JH7100_RSTN_TIMER2 103
#define JH7100_RSTN_TIMER3 104
#define JH7100_RSTN_TIMER4 105
#define JH7100_RSTN_TIMER5 106
#define JH7100_RSTN_TIMER6 107
#define JH7100_RSTN_VP6INTC_APB 108
#define JH7100_RSTN_PWM_APB 109
#define JH7100_RSTN_MSI_APB 110
#define JH7100_RSTN_TEMP_APB 111
#define JH7100_RSTN_TEMP_SENSE 112
#define JH7100_RSTN_SYSERR_APB 113
#define JH7100_RSTN_END 114
#endif /* __DT_BINDINGS_RESET_STARFIVE_JH7100_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment