arm: exynos: Add E850-96 board
Subsystems (8)
Sam Protsenko
maintainercover arm: exynos: Add E850-96 board
NOTE: This patch series depends on "pinctrl: exynos: Prepare for other SoCs support" series [1]. It should be applied first.
Add Exynos850 SoC and WinLink's E850-96 board support. A short overview of series additions and modifications:
* USI driver: configures UART block
* PMU driver: connects AP UART lines to uart1 pins)
* Exynos850 clock driver: generates UART clocks
* Exynos850 pinctrl driver: mux UART pins
* serial_s5p: UART driver
* Exynos850 SoC: dtsi files and MMU maps
* E850-96 board: dts files, defconfig, board file and doc
Most of the code was borrowed from mainline Linux kernel (where this board is already enabled) and adapted for U-Boot. Preliminary preparation for this series includes next patches / series (already merged):
* commit 585a2aaac2ac ("arm: exynos: Include missing CPU header in
soc.c")
* commit c9ab9f30c8e4 ("arm: exynos: Include missing CPU header in
gpio.h")
* commit 11bd2787deff ("watchdog: s5p_wdt: Include missing CPU
header")
* commit 08cfa971a717 ("exynos: Avoid duplicate reset_cpu with
SYSRESET enabled")
* commit f655090901dc ("clk: exynos: Add header guard for clk-pll.h")
* commit 2227f4c0afed ("serial: s5p: Fix clk_get_by_index() error code
check") * commit a0615ffc99a5 ("serial: s5p: Remove common.h inclusion")
* commit 5ad21de6bae0 ("serial: s5p: Use livetree API to get "id" property")
* commit e79f630dbf67 ("serial: s5p: Use named constants for register values")
* commit a627f2802a71 ("serial: s5p: Improve coding style")
* commit 33e7ca5a9b6a ("serial: s5p: Use dev_read_addr_ptr() to get base address")
* commit 6219b47c4d91 ("board: samsung: Fix SYS_CONFIG_NAME configs in axy17lte Kconfig")
* commit 470682ace1e0 ("configs: Remove unneeded SYS_CONFIG_NAME from a*y17lte defconfigs")
and series [1] (dependency) is still pending.
For more detailed description please see the board documentation (added in PATCH #12) and corresponding commit messages.
[1] https://lists.denx.de/pipermail/u-boot/2023-November/539033.html
Sam Protsenko (13):
dt-bindings: soc: samsung: Add Exynos USI
dt-bindings: soc: samsung: Add Exynos PMU
dt-bindings: clock: Add Exynos850 clock controller
soc: samsung: Add Exynos USI driver
soc: samsung: Add Exynos PMU driver
clk: exynos: Move pll code into clk-exynos7420
clk: exynos: Add Samsung clock framework
clk: exynos: Add Exynos850 clock driver
pinctrl: exynos: Add pinctrl support for Exynos850
serial: s5p: Add Exynos850 compatible
arm: exynos: Add Exynos850 SoC support
board: samsung: Add support for E850-96 board
MAINTAINERS: Add new Samsung subsystems
MAINTAINERS | 25 + arch/arm/dts/Makefile | 1 + arch/arm/dts/exynos-pinctrl.h | 79 + arch/arm/dts/exynos850-e850-96-u-boot.dtsi | 37 + arch/arm/dts/exynos850-e850-96.dts | 273 ++++ arch/arm/dts/exynos850-pinctrl.dtsi | 663 +++++++++ arch/arm/dts/exynos850.dtsi | 809 +++++++++++ arch/arm/mach-exynos/Kconfig | 28 +- arch/arm/mach-exynos/mmu-arm64.c | 34 + board/samsung/e850-96/Kconfig | 16 + board/samsung/e850-96/MAINTAINERS | 9 + board/samsung/e850-96/Makefile | 6 + board/samsung/e850-96/e850-96.c | 22 + configs/e850-96_defconfig | 21 + doc/board/samsung/e850-96.rst | 87 ++ .../img/exynos850-boot-architecture.svg | 1283 +++++++++++++++++ doc/board/samsung/index.rst | 1 + .../clock/samsung,exynos850-clock.yaml | 307 ++++ .../soc/samsung/exynos-pmu.yaml | 85 ++ .../soc/samsung/exynos-usi.yaml | 162 +++ drivers/clk/exynos/Kconfig | 7 + drivers/clk/exynos/Makefile | 11 +- drivers/clk/exynos/clk-exynos7420.c | 25 +- drivers/clk/exynos/clk-exynos850.c | 189 +++ drivers/clk/exynos/clk-pll.c | 167 ++- drivers/clk/exynos/clk-pll.h | 16 +- drivers/clk/exynos/clk.c | 121 ++ drivers/clk/exynos/clk.h | 228 +++ drivers/pinctrl/exynos/Kconfig | 8 + drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 ++ drivers/serial/serial_s5p.c | 1 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 33 + drivers/soc/samsung/Makefile | 4 + drivers/soc/samsung/exynos-pmu.c | 102 ++ drivers/soc/samsung/exynos-usi.c | 218 +++ include/configs/e850-96.h | 12 + include/dt-bindings/clock/exynos850.h | 337 +++++ include/dt-bindings/soc/samsung,exynos-usi.h | 17 + 41 files changed, 5548 insertions(+), 24 deletions(-) create mode 100644 arch/arm/dts/exynos-pinctrl.h create mode 100644 arch/arm/dts/exynos850-e850-96-u-boot.dtsi create mode 100644 arch/arm/dts/exynos850-e850-96.dts create mode 100644 arch/arm/dts/exynos850-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos850.dtsi create mode 100644 board/samsung/e850-96/Kconfig create mode 100644 board/samsung/e850-96/MAINTAINERS create mode 100644 board/samsung/e850-96/Makefile create mode 100644 board/samsung/e850-96/e850-96.c create mode 100644 configs/e850-96_defconfig create mode 100644 doc/board/samsung/e850-96.rst create mode 100644 doc/board/samsung/img/exynos850-boot-architecture.svg create mode 100644 doc/device-tree-bindings/clock/samsung,exynos850-clock.yaml create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-pmu.yaml create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-usi.yaml create mode 100644 drivers/clk/exynos/clk-exynos850.c create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.h create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.c create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-pmu.c create mode 100644 drivers/soc/samsung/exynos-usi.c create mode 100644 include/configs/e850-96.h create mode 100644 include/dt-bindings/clock/exynos850.h create mode 100644 include/dt-bindings/soc/samsung,exynos-usi.h
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 1/13 dt-bindings: soc: samsung: Add Exynos USI
Add USI bindings documentation and header file. Those are taken from Linux kernel [1,2], but the documentation was reworked a bit to only describe the compatibles that will be supported in U-Boot soon.
[1] Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml
[2] include/dt-bindings/soc/samsung,exynos-usi.h
--- .../soc/samsung/exynos-usi.yaml | 162 ++++++++++++++++++ include/dt-bindings/soc/samsung,exynos-usi.h | 17 ++ 2 files changed, 179 insertions(+) create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-usi.yaml create mode 100644 include/dt-bindings/soc/samsung,exynos-usi.h
doc/device-tree-bindings/soc/samsung/exynos-usi.yaml new file +162 -0
@@ -0,0 +1,162 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/samsung/exynos-usi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung's Exynos USI (Universal Serial Interface) + +maintainers: + - Sam Protsenko <[email protected]> + +description: | + USI IP-core provides selectable serial protocol (UART, SPI or High-Speed I2C). + USI shares almost all internal circuits within each protocol, so only one + protocol can be chosen at a time. USI is modeled as a node with zero or more + child nodes, each representing a serial sub-node device. The mode setting + selects which particular function will be used. + +properties: + $nodename: + pattern: "^usi@[0-9a-f]+$" + + compatible: + enum: + - samsung,exynos850-usi + + reg: true + + clocks: true + + clock-names: true + + ranges: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + samsung,sysreg: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register syscon node + - description: offset of SW_CONF register for this USI controller + description: + Should be phandle/offset pair. The phandle to System Register syscon node + (for the same domain where this USI controller resides) and the offset + of SW_CONF register for this USI controller. + + samsung,mode: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Selects USI function (which serial protocol to use). Refer to + <include/dt-bindings/soc/samsung,exynos-usi.h> for valid USI mode values. + + samsung,clkreq-on: + type: boolean + description: + Enable this property if underlying protocol requires the clock to be + continuously provided without automatic gating. As suggested by SoC + manual, it should be set in case of SPI/I2C slave, UART Rx and I2C + multi-master mode. Usually this property is needed if USI mode is set + to "UART". + + This property is optional. + +patternProperties: + "^i2c@[0-9a-f]+$": + $ref: /schemas/i2c/i2c-exynos5.yaml + description: Child node describing underlying I2C + + "^serial@[0-9a-f]+$": + $ref: /schemas/serial/samsung_uart.yaml + description: Child node describing underlying UART/serial + + "^spi@[0-9a-f]+$": + $ref: /schemas/spi/samsung,spi.yaml + description: Child node describing underlying SPI + +required: + - compatible + - ranges + - "#address-cells" + - "#size-cells" + - samsung,sysreg + - samsung,mode + +if: + properties: + compatible: + contains: + enum: + - samsung,exynos850-usi + +then: + properties: + reg: + maxItems: 1 + + clocks: + items: + - description: Bus (APB) clock + - description: Operating clock for UART/SPI/I2C protocol + + clock-names: + items: + - const: pclk + - const: ipclk + + required: + - reg + - clocks + - clock-names + +else: + properties: + reg: false + clocks: false + clock-names: false + samsung,clkreq-on: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/soc/samsung,exynos-usi.h> + + usi0: usi@138200c0 { + compatible = "samsung,exynos850-usi"; + reg = <0x138200c0 0x20>; + samsung,sysreg = <&sysreg_peri 0x1010>; + samsung,mode = <USI_V2_UART>; + samsung,clkreq-on; /* needed for UART mode */ + #address-cells = <1>; + #size-cells = <1>; + ranges; + clocks = <&cmu_peri 32>, <&cmu_peri 31>; + clock-names = "pclk", "ipclk"; + + serial_0: serial@13820000 { + compatible = "samsung,exynos850-uart"; + reg = <0x13820000 0xc0>; + interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cmu_peri 32>, <&cmu_peri 31>; + clock-names = "uart", "clk_uart_baud0"; + status = "disabled"; + }; + + hsi2c_0: i2c@13820000 { + compatible = "samsung,exynosautov9-hsi2c"; + reg = <0x13820000 0xc0>; + interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&cmu_peri 31>, <&cmu_peri 32>; + clock-names = "hsi2c", "hsi2c_pclk"; + status = "disabled"; + }; + };
include/dt-bindings/soc/samsung,exynos-usi.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (c) 2021 Linaro Ltd. +* Author: Sam Protsenko <[email protected]> +* +* Device Tree bindings for Samsung Exynos USI (Universal Serial Interface). +*/ + +#ifndef __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H +#define __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H + +#define USI_V2_NONE 0 +#define USI_V2_UART 1 +#define USI_V2_SPI 2 +#define USI_V2_I2C 3 + +#endif /* __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H */
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 2/13 dt-bindings: soc: samsung: Add Exynos PMU
In reply to Sam ProtsenkoAdd bindings documentation for Exynos PMU hardware block. It was taken from Linux kernel [1], but minimized and modified to reflect features that will be actually supported in U-Boot soon. For example, the "samsung,uart-debug-1" property is not available in Linux kernel bindings and only present in U-Boot.
[1] Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
--- .../soc/samsung/exynos-pmu.yaml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-pmu.yaml
doc/device-tree-bindings/soc/samsung/exynos-pmu.yaml new file +85 -0
@@ -0,0 +1,85 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/samsung/exynos-pmu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung Exynos SoC series Power Management Unit (PMU) + +maintainers: + - Sam Protsenko <[email protected]> + +description: |+ + PMU block controls the power and operation states of Exynos SoC. It contains + registers for changing the state of next features:: + + - Local power control. Exynos SoCs have various power domains, and it's + possible to turn them on and off independently, using corresponding + registers in PMU block + - System-level power control. That allows putting the system into power-down + modes (sleep) by turning off the power for most of the domains + - Miscellaneous PMU related features + +# Custom select to avoid matching all nodes with 'syscon' +select: + properties: + compatible: + contains: + enum: + - samsung,exynos850-pmu + required: + - compatible + +properties: + compatible: + oneOf: + - items: + - enum: + - samsung,exynos850-pmu + - const: syscon + + reg: + maxItems: 1 + + samsung,uart-debug-1: + type: boolean + description: + Enable this property if AP UART lines (Application Processor UART) must be + connected to UART_DEBUG_1 path in PMU block. That's usually needed when + the serial console is provided by uart1_pins. If this property is not + specified, the default behavior will be used (AP UART lines connected to + UART_DEBUG_0 path, which usually means uart0_pins are used for the serial + console). + + syscon-poweroff: + $ref: /schemas/power/reset/syscon-poweroff.yaml# + type: object + description: + Node for power off method + + syscon-reboot: + $ref: /schemas/power/reset/syscon-reboot.yaml# + type: object + description: + Node for reboot method + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pmu_system_controller: system-controller@11860000 { + compatible = "samsung,exynos850-pmu", "syscon"; + reg = <0x11860000 0x10000>; + + reboot: syscon-reboot { + compatible = "syscon-reboot"; + regmap = <&pmu_system_controller>; + offset = <0x3a00>; /* SYSTEM_CONFIGURATION */ + mask = <0x2>; /* SWRESET_SYSTEM */ + value = <0x2>; /* reset value */ + }; + };
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 3/13 dt-bindings: clock: Add Exynos850 clock controller
In reply to Sam ProtsenkoAdd bindings documentation and the header file for Exynos850 clock controller. It was taken from Linux kernel [1,2].
[1] Documentation/devicetree/bindings/clock/samsung,exynos850-clock.yaml
[2] include/dt-bindings/clock/exynos850.h
--- .../clock/samsung,exynos850-clock.yaml | 307 ++++++++++++++++ include/dt-bindings/clock/exynos850.h | 337 ++++++++++++++++++ 2 files changed, 644 insertions(+) create mode 100644 doc/device-tree-bindings/clock/samsung,exynos850-clock.yaml create mode 100644 include/dt-bindings/clock/exynos850.h
doc/device-tree-bindings/clock/samsung,exynos850-clock.yaml new file +307 -0
@@ -0,0 +1,307 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/samsung,exynos850-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung Exynos850 SoC clock controller + +maintainers: + - Sam Protsenko <[email protected]> + +description: | + Exynos850 clock controller is comprised of several CMU units, generating + clocks for different domains. Those CMU units are modeled as separate device + tree nodes, and might depend on each other. Root clocks in that clock tree are + two external clocks:: OSCCLK (26 MHz) and RTCCLK (32768 Hz). Those external + clocks must be defined as fixed-rate clocks in dts. + + CMU_TOP is a top-level CMU, where all base clocks are prepared using PLLs and + dividers; all other leaf clocks (other CMUs) are usually derived from CMU_TOP. + + Each clock is assigned an identifier and client nodes can use this identifier + to specify the clock which they consume. All clocks available for usage + in clock consumer nodes are defined as preprocessor macros in + 'dt-bindings/clock/exynos850.h' header. + +properties: + compatible: + enum: + - samsung,exynos850-cmu-top + - samsung,exynos850-cmu-apm + - samsung,exynos850-cmu-aud + - samsung,exynos850-cmu-cmgp + - samsung,exynos850-cmu-core + - samsung,exynos850-cmu-dpu + - samsung,exynos850-cmu-g3d + - samsung,exynos850-cmu-hsi + - samsung,exynos850-cmu-is + - samsung,exynos850-cmu-mfcmscl + - samsung,exynos850-cmu-peri + + clocks: + minItems: 1 + maxItems: 5 + + clock-names: + minItems: 1 + maxItems: 5 + + "#clock-cells": + const: 1 + + reg: + maxItems: 1 + +allOf: + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-top + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + + clock-names: + items: + - const: oscclk + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-apm + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CMU_APM bus clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_clkcmu_apm_bus + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-aud + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: AUD clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_aud + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-cmgp + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CMU_CMGP bus clock (from CMU_APM) + + clock-names: + items: + - const: oscclk + - const: gout_clkcmu_cmgp_bus + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-core + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CMU_CORE bus clock (from CMU_TOP) + - description: CCI clock (from CMU_TOP) + - description: eMMC clock (from CMU_TOP) + - description: SSS clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_core_bus + - const: dout_core_cci + - const: dout_core_mmc_embd + - const: dout_core_sss + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-dpu + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: DPU clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_dpu + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-g3d + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: G3D clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_g3d_switch + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-hsi + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: External RTC clock (32768 Hz) + - description: CMU_HSI bus clock (from CMU_TOP) + - description: SD card clock (from CMU_TOP) + - description: USB 2.0 DRD clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: rtcclk + - const: dout_hsi_bus + - const: dout_hsi_mmc_card + - const: dout_hsi_usb20drd + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-is + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CMU_IS bus clock (from CMU_TOP) + - description: Image Texture Processing core clock (from CMU_TOP) + - description: Visual Recognition Accelerator clock (from CMU_TOP) + - description: Geometric Distortion Correction clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_is_bus + - const: dout_is_itp + - const: dout_is_vra + - const: dout_is_gdc + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-mfcmscl + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: Multi-Format Codec clock (from CMU_TOP) + - description: Memory to Memory Scaler clock (from CMU_TOP) + - description: Multi-Channel Scaler clock (from CMU_TOP) + - description: JPEG codec clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_mfcmscl_mfc + - const: dout_mfcmscl_m2m + - const: dout_mfcmscl_mcsc + - const: dout_mfcmscl_jpeg + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-peri + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CMU_PERI bus clock (from CMU_TOP) + - description: UART clock (from CMU_TOP) + - description: Parent clock for HSI2C and SPI (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_peri_bus + - const: dout_peri_uart + - const: dout_peri_ip + +required: + - compatible + - "#clock-cells" + - clocks + - clock-names + - reg + +additionalProperties: false + +examples: + # Clock controller node for CMU_PERI + - | + #include <dt-bindings/clock/exynos850.h> + + cmu_peri: clock-controller@10030000 { + compatible = "samsung,exynos850-cmu-peri"; + reg = <0x10030000 0x8000>; + #clock-cells = <1>; + + clocks = <&oscclk>, <&cmu_top CLK_DOUT_PERI_BUS>, + <&cmu_top CLK_DOUT_PERI_UART>, + <&cmu_top CLK_DOUT_PERI_IP>; + clock-names = "oscclk", "dout_peri_bus", + "dout_peri_uart", "dout_peri_ip"; + }; + +...
include/dt-bindings/clock/exynos850.h new file +337 -0
337 lines not on this page · raw message
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 4/13 soc: samsung: Add Exynos USI driver
In reply to Sam ProtsenkoUSIv2 IP-core is found on modern ARM64 Exynos SoCs (like Exynos850) and provides selectable serial protocol (one of: UART, SPI, I2C). USIv2 registers usually reside in the same register map as a particular underlying protocol it implements, but have some particular offset. E.g. on Exynos850 the USI_UART has 0x13820000 base address, where UART registers have 0x00..0x40 offsets, and USI registers have 0xc0..0xdc offsets. Desired protocol can be chosen via SW_CONF register from System Register block of the same domain as USI.
Before starting to use a particular protocol, USIv2 must be configured properly:
1. Select protocol to be used via System Register
2. Clear "reset" flag in USI_CON
3. Configure HWACG behavior (e.g. for UART Rx the HWACG must be disabled, so that the IP clock is not gated automatically); this is done using USI_OPTION register
4. Keep both USI clocks (PCLK and IPCLK) running during USI registers modification
This driver implements the above behavior. Of course, USIv2 driver should be probed before UART/I2C/SPI drivers. It can be achieved by embedding UART/I2C/SPI nodes inside of the USI node (in Device Tree); driver then walks underlying nodes and instantiates those. Driver also handles USI configuration on PM resume, as register contents can be lost during CPU suspend.
This driver is designed with different USI versions in mind. So it should be relatively easy to add new USI revisions to it later.
Driver's code was copied over from Linux kernel [1] and adapted correspondingly for U-Boot API. UCLASS_MISC is used, and although no misc operations are implemented, it makes it easier to probe the driver this way (as compared to UCLASS_NOP) and keep the code compact.
[1] drivers/soc/samsung/exynos-usi.c
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 23 ++++ drivers/soc/samsung/Makefile | 3 + drivers/soc/samsung/exynos-usi.c | 218 +++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-usi.c
drivers/soc/Kconfig +1 -0
@@ -40,6 +40,7 @@ config SOC_XILINX_VERSAL_NET This allows other drivers to verify the SoC familiy & revision using matching SoC attributes. +source "drivers/soc/samsung/Kconfig" source "drivers/soc/ti/Kconfig" endmenu
drivers/soc/Makefile +1 -0
@@ -2,6 +2,7 @@ # # Makefile for the U-Boot SOC specific device drivers. +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o obj-$(CONFIG_SOC_DEVICE_TI_K3) += soc_ti_k3.o
drivers/soc/samsung/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ + +menuconfig SOC_SAMSUNG + bool "Samsung SoC drivers support" + +if SOC_SAMSUNG + +config EXYNOS_USI + bool "Exynos USI (Universal Serial Interface) driver" + depends on ARCH_EXYNOS + select MISC + select REGMAP + select SYSCON + help + Enable support for USI block. USI (Universal Serial Interface) is an + IP-core found in modern Samsung Exynos SoCs, like Exynos850 and + ExynosAutoV9. USI block can be configured to provide one of the + following serial protocols: UART, SPI or High Speed I2C. + + This driver allows one to configure USI for desired protocol, which + is usually done in USI node in Device Tree. + +endif
drivers/soc/samsung/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_EXYNOS_USI) += exynos-usi.o
drivers/soc/samsung/exynos-usi.c new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH 04/13] soc: samsung: Add Exynos USI driver
Quoted 38 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 04/13] soc: samsung: Add Exynos USI driverUSIv2 IP-core is found on modern ARM64 Exynos SoCs (like Exynos850) and provides selectable serial protocol (one of: UART, SPI, I2C). USIv2 registers usually reside in the same register map as a particular underlying protocol it implements, but have some particular offset. E.g. on Exynos850 the
USI_UARThas0x13820000base address, where UART registers have 0x00..0x40 offsets, and USI registers have 0xc0..0xdc offsets. Desired protocol can be chosen viaSW_CONFregister from System Register block of the same domain as USI.Before starting to use a particular protocol, USIv2 must be configured properly:
1. Select protocol to be used via System Register
2. Clear "reset" flag inUSI_CON
3. Configure HWACG behavior (e.g. for UART Rx the HWACG must be disabled, so that the IP clock is not gated automatically); this is done usingUSI_OPTIONregister
4. Keep both USI clocks (PCLK and IPCLK) running during USI registers modificationThis driver implements the above behavior. Of course, USIv2 driver should be probed before UART/I2C/SPI drivers. It can be achieved by embedding UART/I2C/SPI nodes inside of the USI node (in Device Tree); driver then walks underlying nodes and instantiates those. Driver also handles USI configuration on PM resume, as register contents can be lost during CPU suspend.
This driver is designed with different USI versions in mind. So it should be relatively easy to add new USI revisions to it later.
Quoted 8 lines
Driver's code was copied over from Linux kernel [1] and adapted correspondingly for U-Boot API.
UCLASS_MISCis used, and although no misc operations are implemented, it makes it easier to probe the driver this way (as compared toUCLASS_NOP) and keep the code compact.[1]
drivers/soc/samsung/exynos-usi.cSigned-off-by Sam Protsenko <[email protected]>
Re: [PATCH 04/13] soc: samsung: Add Exynos USI driver
In reply to Sam ProtsenkoHi
2023년 12월 13일 (수) 12:42, Sam Protsenko <[email protected]>님이 작성:
Quoted 215 lines
USIv2 IP-core is found on modern ARM64 Exynos SoCs (like Exynos850) and provides selectable serial protocol (one of: UART, SPI, I2C). USIv2 registers usually reside in the same register map as a particular underlying protocol it implements, but have some particular offset. E.g. on Exynos850 the
USI_UARThas0x13820000base address, where UART registers have 0x00..0x40 offsets, and USI registers have 0xc0..0xdc offsets. Desired protocol can be chosen viaSW_CONFregister from System Register block of the same domain as USI.Before starting to use a particular protocol, USIv2 must be configured properly:
1. Select protocol to be used via System Register
2. Clear "reset" flag inUSI_CON
3. Configure HWACG behavior (e.g. for UART Rx the HWACG must be disabled, so that the IP clock is not gated automatically); this is done usingUSI_OPTIONregister
4. Keep both USI clocks (PCLK and IPCLK) running during USI registers modificationThis driver implements the above behavior. Of course, USIv2 driver should be probed before UART/I2C/SPI drivers. It can be achieved by embedding UART/I2C/SPI nodes inside of the USI node (in Device Tree); driver then walks underlying nodes and instantiates those. Driver also handles USI configuration on PM resume, as register contents can be lost during CPU suspend.
This driver is designed with different USI versions in mind. So it should be relatively easy to add new USI revisions to it later.
Driver's code was copied over from Linux kernel [1] and adapted correspondingly for U-Boot API.
UCLASS_MISCis used, and although no misc operations are implemented, it makes it easier to probe the driver this way (as compared toUCLASS_NOP) and keep the code compact.[1]
drivers/soc/samsung/exynos-usi.cSigned-off-by Sam Protsenko <[email protected]>--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 23 ++++ drivers/soc/samsung/Makefile | 3 + drivers/soc/samsung/exynos-usi.c | 218 +++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-usi.cdrivers/soc/Kconfig +0
-0@@ -40,6 +40,7 @@ config SOC_XILINX_VERSAL_NET This allows other drivers to verify the SoC familiy & revisionusing
matching SoC attributes.drivers/soc/Kconfig +1
-0+source "drivers/soc/samsung/Kconfig" source "drivers/soc/ti/Kconfig" endmenudrivers/soc/Makefile +1
-0@@ -2,6 +2,7 @@ # # Makefile for the U-Boot SOC specific device drivers. +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o obj-$(CONFIG_SOC_DEVICE_TI_K3) += soc_ti_k3.odrivers/soc/samsung/Kconfig new file +15
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ + +menuconfig SOC_SAMSUNG + bool "Samsung SoC drivers support" + +if SOC_SAMSUNG + +config EXYNOS_USI + bool "Exynos USI (Universal Serial Interface) driver" + depends on ARCH_EXYNOS + select MISC + select REGMAP + select SYSCON + help + Enable support for USI block. USI (Universal Serial Interface)is an
drivers/soc/samsung/Kconfig new file +5
-0+ IP-core found in modern Samsung Exynos SoCs, like Exynos850 and + ExynosAutoV9. USI block can be configured to provide one of the + following serial protocols: UART, SPI or High Speed I2C. + + This driver allows one to configure USI for desired protocol,which
drivers/soc/samsung/Kconfig new file +3
-0+ is usually done in USI node in Device Tree. + +endifdrivers/soc/samsung/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_EXYNOS_USI) += exynos-usi.odrivers/soc/samsung/exynos-usi.c new file +26
-0@@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 Linaro Ltd. +* Author: Sam Protsenko <[email protected]> +* +* Samsung Exynos USI driver (Universal Serial Interface). +*/ + +#include <dm.h> +#include <dm/device_compat.h> +#include <errno.h> +#include <regmap.h> +#include <syscon.h> +#include <asm/io.h> +#include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/err.h> + +#include <dt-bindings/soc/samsung,exynos-usi.h> + +/* USIv2: System Register: SW_CONF register bits */ +#define USI_V2_SW_CONF_NONE 0x0 +#define USI_V2_SW_CONF_UART BIT(0) +#define USI_V2_SW_CONF_SPI BIT(1) +#define USI_V2_SW_CONF_I2C BIT(2) +#define USI_V2_SW_CONF_MASK (USI_V2_SW_CONF_UART | USI_V2_SW_CONF_SPI| \
drivers/soc/samsung/exynos-usi.c new file +18
-0+ USI_V2_SW_CONF_I2C) + +/* USIv2: USI register offsets */ +#define USI_CON 0x04 +#define USI_OPTION 0x08 + +/* USIv2: USI register bits */ +#define USI_CON_RESET BIT(0) +#define USI_OPTION_CLKREQ_ON BIT(1) +#define USI_OPTION_CLKSTOP_ON BIT(2) + +enum exynos_usi_ver { +USI_VER2 =2 , +}; + +struct exynos_usi_variant { +enum exynos_usi_ver ver;/* USI IP-core version */ +unsigned int sw_conf_mask;/* SW_CONF mask for all protocols */
+size_tmin_mode; /* first index in
exynos_usi_modes[] */
+size_tmax_mode; /* last index in
exynos_usi_modes[] */drivers/soc/samsung/exynos-usi.c new file +7
-0+}; + +struct exynos_usi { +struct udevice *dev; +void __iomem *regs;/* USI register map */ + +size_t mode;/* current USI SW_CONF mode index */
drivers/soc/samsung/exynos-usi.c new file +5
-0+bool clkreq_on;/* always provide clock to IP */ + +/* System Register */ +struct regmap *sysreg;/* System Register map */ +unsigned int sw_conf;/* SW_CONF register offset in sysreg */
drivers/soc/samsung/exynos-usi.c new file +31
-0+ +const struct exynos_usi_variant *data; +}; + +struct exynos_usi_mode { +const char *name;/* mode name */ +unsigned int val;/* mode register value */ +}; + +static const struct exynos_usi_mode exynos_usi_modes[] = { + [USI_V2_NONE ] = { .name ="none" , .val =USI_V2_SW_CONF_NONE }, + [USI_V2_UART ] = { .name ="uart" , .val =USI_V2_SW_CONF_UART }, + [USI_V2_SPI ] = { .name ="spi" , .val =USI_V2_SW_CONF_SPI }, + [USI_V2_I2C ] = { .name ="i2c" , .val =USI_V2_SW_CONF_I2C }, +}; + +static const struct exynos_usi_variant exynos850_usi_data = { + .ver =USI_VER2 , + .sw_conf_mask =USI_V2_SW_CONF_MASK , + .min_mode =USI_V2_NONE , + .max_mode =USI_V2_I2C , +}; + +static const struct udevice_id exynos_usi_ids[] = { + { + .compatible ="samsung,exynos850-usi" , + .data = (ulong)&exynos850_usi_data, + }, + { }/* sentinel */ +}; +
drivers/soc/samsung/exynos-usi.c line 99
Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +10
-0+/** +* exynos_usi_set_sw_conf - Set USI block configuration mode +* @usi: USI driver object +* @mode: Mode index +* +* Select underlying serial protocol (UART/SPI/I2C) in USI IP-core. +* +* Return: 0 on success, or negative error code on failure. +*/ +static int exynos_usi_set_sw_conf (struct exynos_usi *usi,size_t mode)
The value of mode is same as usi->mode, but is there a reason to pass it as a parameter?
Quoted 4 lines
drivers/soc/samsung/exynos-usi.c new file +4
-0+{ +unsigned int val; +int ret; +
drivers/soc/samsung/exynos-usi.c line 113
Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +10
-0+if (mode < usi->data->min_mode || mode > usi->data->max_mode) +return -EINVAL ; + + val = exynos_usi_modes[mode].val; + ret =regmap_update_bits (usi->sysreg, usi->sw_conf, + usi->data->sw_conf_mask, val); +if (ret) +return ret; + + usi->mode = mode;
This will obviously be the same value always.
Quoted 111 lines
+ dev_dbg(usi->dev, "protocol: %s\n",
exynos_usi_modes[usi->mode].name);drivers/soc/samsung/exynos-usi.c new file +9
-0+ +return 0 ; +} + +/** +* exynos_usi_enable - Initialize USI block +* @usi: USI driver object +* +* USI IP-core start state is "reset" (on startup and after CPU resume). This
+ * routine enables the USI block by clearing the reset flag. It also configures
+ * HWACG behavior (needed e.g. for UART Rx). It should be performed before
+ * underlying protocol becomes functional.
+ */drivers/soc/samsung/exynos-usi.c new file +50
-0+static void exynos_usi_enable (const struct exynos_usi *usi) +{ +u32 val; + +/* Enable USI block */ + val =readl (usi->regs +USI_CON ); + val &= ~USI_CON_RESET ; +writel (val, usi->regs +USI_CON ); +udelay (1 ); + +/* Continuously provide the clock to USI IP w/o gating */ +if (usi->clkreq_on) { + val =readl (usi->regs +USI_OPTION ); + val &= ~USI_OPTION_CLKSTOP_ON ; + val |=USI_OPTION_CLKREQ_ON ; +writel (val, usi->regs +USI_OPTION ); + } +} + +static int exynos_usi_configure (struct exynos_usi *usi) +{ +int ret; + + ret =exynos_usi_set_sw_conf (usi, usi->mode); +if (ret) +return ret; + +if (usi->data->ver ==USI_VER2 ) +exynos_usi_enable (usi); + +return 0 ; +} + +static int exynos_usi_parse_dt (struct exynos_usi *usi) +{ +struct udevice *dev = usi->dev; +ofnode node; +int ret; +u32 mode; + + node =dev_ofnode (dev); + + ret =ofnode_read_u32 (node,"samsung,mode" , &mode); +if (ret) +return ret; +if (mode < usi->data->min_mode || mode > usi->data->max_mode) +return -EINVAL ; + usi->mode = mode; + + usi->sysreg = syscon_regmap_lookup_by_phandle(dev,"samsung,sysreg");
drivers/soc/samsung/exynos-usi.c new file +4
-0+if (IS_ERR (usi->sysreg)) +return PTR_ERR (usi->sysreg); + + ret = ofnode_read_u32_index(node, "samsung,sysreg", 1,
&usi->sw_conf);drivers/soc/samsung/exynos-usi.c new file +37
-1+if (ret) +return ret; + + usi->clkreq_on =ofnode_read_bool (node,"samsung,clkreq-on" ); + +return 0 ; +} + +static int exynos_usi_probe (struct udevice *dev) +{ +struct exynos_usi *usi; +int ret; + + usi =dev_get_priv (dev); + usi->dev = dev; + usi->data = (struct exynos_usi_variant *)dev_get_driver_data (dev); + + ret =exynos_usi_parse_dt (usi); +if (ret) +return ret; + +if (usi->data->ver ==USI_VER2 ) { + usi->regs =dev_read_addr_ptr (dev); +if (!usi->regs) +return -ENODEV ; + } + +return exynos_usi_configure (usi); +} + +U_BOOT_DRIVER (exynos_usi) = { + .name ="exynos-usi" , + .id =UCLASS_MISC , + .of_match = exynos_usi_ids, + .probe = exynos_usi_probe, + .priv_auto =sizeof (struct exynos_usi ), +}; --
Quoted 2 lines
2.39.2
Thanks.
Minkyu Kang.
Sam Protsenko
maintainerRe: [PATCH 04/13] soc: samsung: Add Exynos USI driver
Quoted 6 lines · Minkyu Kang
Hi
2023년 12월 13일 (수) 12:42, Sam Protsenko <[email protected]>님이 작성:
Quoted 1 line
[snip]
Quoted 25 lines
drivers/soc/samsung/exynos-usi.c line 99
Quoted 11 lines
drivers/soc/samsung/exynos-usi.c new file +11
-0+ +/** +* exynos_usi_set_sw_conf - Set USI block configuration mode +* @usi: USI driver object +* @mode: Mode index +* +* Select underlying serial protocol (UART/SPI/I2C) in USI IP-core. +* +* Return: 0 on success, or negative error code on failure. +*/ +static int exynos_usi_set_sw_conf (struct exynos_usi *usi,size_t mode)The value of mode is same as
usi->mode, but is there a reason to pass it as a parameter?Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +9
-0+{ +unsigned int val; +int ret; + +if (mode < usi->data->min_mode || mode > usi->data->max_mode) +return -EINVAL ; + + val = exynos_usi_modes[mode].val; + ret = regmap_update_bits(usi->sysreg, usi->sw_conf,
Quoted 9 lines
drivers/soc/samsung/exynos-usi.c line 113
Quoted 5 lines
drivers/soc/samsung/exynos-usi.c new file +5
-0+ usi->data->sw_conf_mask, val); +if (ret) +return ret; + + usi->mode = mode;This will obviously be the same value always.
Thanks for the review! Yes, you are right. This code was copy-pasted from Linux kernel. So at the time I thought it was better to leave it as is, for backporting reasons. But now that I look at it, this won't be too helpful. So I'll get rid of it in v2.
[snip]
Re: [PATCH 04/13] soc: samsung: Add Exynos USI driver
In reply to Sam ProtsenkoHi Sam,
Quoted 38 lines · Sam Protsenko
USIv2 IP-core is found on modern ARM64 Exynos SoCs (like Exynos850) and provides selectable serial protocol (one of: UART, SPI, I2C). USIv2 registers usually reside in the same register map as a particular underlying protocol it implements, but have some particular offset. E.g. on Exynos850 the
USI_UARThas0x13820000base address, where UART registers have 0x00..0x40 offsets, and USI registers have 0xc0..0xdc offsets. Desired protocol can be chosen viaSW_CONFregister from System Register block of the same domain as USI.Before starting to use a particular protocol, USIv2 must be configured properly:
1. Select protocol to be used via System Register
2. Clear "reset" flag inUSI_CON
3. Configure HWACG behavior (e.g. for UART Rx the HWACG must be disabled, so that the IP clock is not gated automatically); this is done usingUSI_OPTIONregister
4. Keep both USI clocks (PCLK and IPCLK) running during USI registers modificationThis driver implements the above behavior. Of course, USIv2 driver should be probed before UART/I2C/SPI drivers. It can be achieved by embedding UART/I2C/SPI nodes inside of the USI node (in Device Tree); driver then walks underlying nodes and instantiates those. Driver also handles USI configuration on PM resume, as register contents can be lost during CPU suspend.
This driver is designed with different USI versions in mind. So it should be relatively easy to add new USI revisions to it later.
Driver's code was copied over from Linux kernel [1] and adapted correspondingly for U-Boot API.
UCLASS_MISCis used, and although no misc operations are implemented, it makes it easier to probe the driver this way (as compared toUCLASS_NOP) and keep the code compact.[1]
drivers/soc/samsung/exynos-usi.cSigned-off-by Sam Protsenko <[email protected]>
Quoted 11 lines
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 23 ++++ drivers/soc/samsung/Makefile | 3 + drivers/soc/samsung/exynos-usi.c | 218 +++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-usi.c
Just a few nits here
Quoted 108 lines
drivers/soc/Kconfig +1
-0@@ -40,6 +40,7 @@ config SOC_XILINX_VERSAL_NET This allows other drivers to verify the SoC familiy & revision using matching SoC attributes. +source "drivers/soc/samsung/Kconfig" source "drivers/soc/ti/Kconfig" endmenudrivers/soc/Makefile +1
-0@@ -2,6 +2,7 @@ # # Makefile for the U-Boot SOC specific device drivers. +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o obj-$(CONFIG_SOC_DEVICE_TI_K3) += soc_ti_k3.odrivers/soc/samsung/Kconfig new file +23
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ + +menuconfig SOC_SAMSUNG + bool "Samsung SoC drivers support" + +if SOC_SAMSUNG + +config EXYNOS_USI + bool "Exynos USI (Universal Serial Interface) driver" + depends on ARCH_EXYNOS + select MISC + select REGMAP + select SYSCON + help + Enable support for USI block. USI (Universal Serial Interface) is an + IP-core found in modern Samsung Exynos SoCs, like Exynos850 and + ExynosAutoV9. USI block can be configured to provide one of the + following serial protocols: UART, SPI or High Speed I2C. + + This driver allows one to configure USI for desired protocol, which + is usually done in USI node in Device Tree. + +endifdrivers/soc/samsung/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_EXYNOS_USI) += exynos-usi.odrivers/soc/samsung/exynos-usi.c new file +40
-0@@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 Linaro Ltd. +* Author: Sam Protsenko <[email protected]> +* +* Samsung Exynos USI driver (Universal Serial Interface). +*/ + +#include <dm.h> +#include <dm/device_compat.h> +#include <errno.h> +#include <regmap.h> +#include <syscon.h> +#include <asm/io.h> +#include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/err.h> + +#include <dt-bindings/soc/samsung,exynos-usi.h> + +/* USIv2: System Register: SW_CONF register bits */ +#define USI_V2_SW_CONF_NONE 0x0 +#define USI_V2_SW_CONF_UART BIT(0) +#define USI_V2_SW_CONF_SPI BIT(1) +#define USI_V2_SW_CONF_I2C BIT(2) +#define USI_V2_SW_CONF_MASK (USI_V2_SW_CONF_UART | USI_V2_SW_CONF_SPI | \ + USI_V2_SW_CONF_I2C) + +/* USIv2: USI register offsets */ +#define USI_CON 0x04 +#define USI_OPTION 0x08 + +/* USIv2: USI register bits */ +#define USI_CON_RESET BIT(0) +#define USI_OPTION_CLKREQ_ON BIT(1) +#define USI_OPTION_CLKSTOP_ON BIT(2) + +enum exynos_usi_ver { +USI_VER2 =2 , +};
drivers/soc/samsung/exynos-usi.c line 50
Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +10
-0+ +struct exynos_usi_variant { +enum exynos_usi_ver ver;/* USI IP-core version */ +unsigned int sw_conf_mask;/* SW_CONF mask for all protocols */ +size_t min_mode;/* first index in exynos_usi_modes[] */ +size_t max_mode;/* last index in exynos_usi_modes[] */ +}; + +struct exynos_usi { +struct udevice *dev;
Can we drop this? It doesn't seem very useful and we try to avoid having bidirectional pointers. since it is possible to get the 'priv' pointer from the device.
Quoted 101 lines
drivers/soc/samsung/exynos-usi.c new file +101
-0+void __iomem *regs;/* USI register map */ + +size_t mode;/* current USI SW_CONF mode index */ +bool clkreq_on;/* always provide clock to IP */ + +/* System Register */ +struct regmap *sysreg;/* System Register map */ +unsigned int sw_conf;/* SW_CONF register offset in sysreg */ + +const struct exynos_usi_variant *data; +}; + +struct exynos_usi_mode { +const char *name;/* mode name */ +unsigned int val;/* mode register value */ +}; + +static const struct exynos_usi_mode exynos_usi_modes[] = { + [USI_V2_NONE ] = { .name ="none" , .val =USI_V2_SW_CONF_NONE }, + [USI_V2_UART ] = { .name ="uart" , .val =USI_V2_SW_CONF_UART }, + [USI_V2_SPI ] = { .name ="spi" , .val =USI_V2_SW_CONF_SPI }, + [USI_V2_I2C ] = { .name ="i2c" , .val =USI_V2_SW_CONF_I2C }, +}; + +static const struct exynos_usi_variant exynos850_usi_data = { + .ver =USI_VER2 , + .sw_conf_mask =USI_V2_SW_CONF_MASK , + .min_mode =USI_V2_NONE , + .max_mode =USI_V2_I2C , +}; + +static const struct udevice_id exynos_usi_ids[] = { + { + .compatible ="samsung,exynos850-usi" , + .data = (ulong)&exynos850_usi_data, + }, + { }/* sentinel */ +}; + +/** +* exynos_usi_set_sw_conf - Set USI block configuration mode +* @usi: USI driver object +* @mode: Mode index +* +* Select underlying serial protocol (UART/SPI/I2C) in USI IP-core. +* +* Return: 0 on success, or negative error code on failure. +*/ +static int exynos_usi_set_sw_conf (struct exynos_usi *usi,size_t mode) +{ +unsigned int val; +int ret; + +if (mode < usi->data->min_mode || mode > usi->data->max_mode) +return -EINVAL ; + + val = exynos_usi_modes[mode].val; + ret =regmap_update_bits (usi->sysreg, usi->sw_conf, + usi->data->sw_conf_mask, val); +if (ret) +return ret; + + usi->mode = mode; +dev_dbg (usi->dev,"protocol: %s\n" , exynos_usi_modes[usi->mode].name); + +return 0 ; +} + +/** +* exynos_usi_enable - Initialize USI block +* @usi: USI driver object +* +* USI IP-core start state is "reset" (on startup and after CPU resume). This +* routine enables the USI block by clearing the reset flag. It also configures +* HWACG behavior (needed e.g. for UART Rx). It should be performed before +* underlying protocol becomes functional. +*/ +static void exynos_usi_enable (const struct exynos_usi *usi) +{ +u32 val; + +/* Enable USI block */ + val =readl (usi->regs +USI_CON ); + val &= ~USI_CON_RESET ; +writel (val, usi->regs +USI_CON ); +udelay (1 ); + +/* Continuously provide the clock to USI IP w/o gating */ +if (usi->clkreq_on) { + val =readl (usi->regs +USI_OPTION ); + val &= ~USI_OPTION_CLKSTOP_ON ; + val |=USI_OPTION_CLKREQ_ON ; +writel (val, usi->regs +USI_OPTION ); + } +} + +static int exynos_usi_configure (struct exynos_usi *usi) +{ +int ret; + + ret =exynos_usi_set_sw_conf (usi, usi->mode);
drivers/soc/samsung/exynos-usi.c line 161
Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +10
-0+if (ret) +return ret; + +if (usi->data->ver ==USI_VER2 ) +exynos_usi_enable (usi); + +return 0 ; +} + +static int exynos_usi_parse_dt (struct exynos_usi *usi)
Use of_to_plat() method?
Quoted 25 lines
drivers/soc/samsung/exynos-usi.c new file +25
-0+{ +struct udevice *dev = usi->dev; +ofnode node; +int ret; +u32 mode; + + node =dev_ofnode (dev); + + ret =ofnode_read_u32 (node,"samsung,mode" , &mode); +if (ret) +return ret; +if (mode < usi->data->min_mode || mode > usi->data->max_mode) +return -EINVAL ; + usi->mode = mode; + + usi->sysreg =syscon_regmap_lookup_by_phandle (dev,"samsung,sysreg" ); +if (IS_ERR (usi->sysreg)) +return PTR_ERR (usi->sysreg); + + ret =ofnode_read_u32_index (node,"samsung,sysreg" ,1 , &usi->sw_conf); +if (ret) +return ret; + + usi->clkreq_on =ofnode_read_bool (node,"samsung,clkreq-on" ); +
drivers/soc/samsung/exynos-usi.c line 196
Quoted 10 lines
drivers/soc/samsung/exynos-usi.c new file +10
-0+return 0 ; +} + +static int exynos_usi_probe (struct udevice *dev) +{ +struct exynos_usi *usi; +int ret; + + usi =dev_get_priv (dev); + usi->dev = dev;
Hoping you can drop that
Quoted 23 lines
drivers/soc/samsung/exynos-usi.c new file +22
-1+ usi->data = (struct exynos_usi_variant *)dev_get_driver_data (dev); + + ret =exynos_usi_parse_dt (usi); +if (ret) +return ret; + +if (usi->data->ver ==USI_VER2 ) { + usi->regs =dev_read_addr_ptr (dev); +if (!usi->regs) +return -ENODEV ; + } + +return exynos_usi_configure (usi); +} + +U_BOOT_DRIVER (exynos_usi) = { + .name ="exynos-usi" , + .id =UCLASS_MISC , + .of_match = exynos_usi_ids, + .probe = exynos_usi_probe, + .priv_auto =sizeof (struct exynos_usi ), +}; --
Quoted 2 lines
2.39.2
Regards,
Simon
Sam Protsenko
maintainerRe: [PATCH 04/13] soc: samsung: Add Exynos USI driver
Quoted 3 lines · Simon Glass
Hi Sam,
[snip]
Quoted 5 lines
Just a few nits here
Reviewed-by Simon Glass <[email protected]>
[snip]
Quoted 8 lines
drivers/soc/samsung/exynos-usi.c line 50
Quoted 3 lines
drivers/soc/samsung/exynos-usi.c new file +3
-0+ +struct exynos_usi { +struct udevice *dev;Can we drop this? It doesn't seem very useful and we try to avoid having bidirectional pointers. since it is possible to get the 'priv' pointer from the device.
Sure. I tried to keep the driver as close as possible to Linux kernel's version, where I borrowed it from. But if it's the current preference in U-Boot, I'll fix this in v2.
[snip]
Quoted 4 lines
Quoted 1 line
+static int
exynos_usi_parse_dt(struct exynos_usi *usi)Use
of_to_plat()method?
Will do in v2. Thanks for the review!
[snip]
Sam Protsenko
maintainerPATCH 5/13 soc: samsung: Add Exynos PMU driver
In reply to Sam ProtsenkoAdd basic Power Management Unit (PMU) driver for Exynos SoCs. For now it's only capable of changing UART path in PMU, which is needed for E850-96 board. The driver's structure resembles the exynos-pmu driver from Linux kernel, and although it's very basic and slim at the moment, it can be easily extended in future if the need arises.
UCLASS_NOP is used, as there are no benefits in using more elaborate classes like UCLASS_MISC in this case. The DM_FLAG_PROBE_AFTER_BIND flag is added in bind function, as the probe function must be always called for this driver.
--- drivers/soc/samsung/Kconfig | 10 +++ drivers/soc/samsung/Makefile | 1 + drivers/soc/samsung/exynos-pmu.c | 102 +++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 drivers/soc/samsung/exynos-pmu.c
drivers/soc/samsung/Kconfig +10 -0
@@ -5,6 +5,16 @@ menuconfig SOC_SAMSUNG if SOC_SAMSUNG +config EXYNOS_PMU + bool "Exynos PMU controller driver" + depends on ARCH_EXYNOS + select REGMAP + select SYSCON + help + Enable support for system controller configuration driver. It allows + one to configure system controller registers (e.g. some register in + PMU syscon) by providing register's offset, mask and value. + config EXYNOS_USI bool "Exynos USI (Universal Serial Interface) driver" depends on ARCH_EXYNOS
drivers/soc/samsung/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ +obj-$(CONFIG_EXYNOS_PMU) += exynos-pmu.o obj-$(CONFIG_EXYNOS_USI) += exynos-usi.o
drivers/soc/samsung/exynos-pmu.c new file +102 -0
102 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH 05/13] soc: samsung: Add Exynos PMU driver
Quoted 15 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 05/13] soc: samsung: Add Exynos PMU driverAdd basic Power Management Unit (PMU) driver for Exynos SoCs. For now it's only capable of changing UART path in PMU, which is needed for E850-96 board. The driver's structure resembles the exynos-pmu driver from Linux kernel, and although it's very basic and slim at the moment, it can be easily extended in future if the need arises.
Quoted 6 lines
UCLASS_NOPis used, as there are no benefits in using more elaborate classes likeUCLASS_MISCin this case. TheDM_FLAG_PROBE_AFTER_BINDflag is added in bind function, as the probe function must be always called for this driver.Signed-off-by Sam Protsenko <[email protected]>
Sam Protsenko
maintainerPATCH 6/13 clk: exynos: Move pll code into clk-exynos7420
In reply to Sam ProtsenkoPLL utilities code is only used by clk-exynos7420 driver at the moment. Move it into clk-exynos7420 to make clk-pll.c file available for CCF PLL clocks implementation, which is coming in the next patches.
--- drivers/clk/exynos/Makefile | 1 - drivers/clk/exynos/clk-exynos7420.c | 25 +++++++++++++++++++++- drivers/clk/exynos/clk-pll.c | 32 ----------------------------- drivers/clk/exynos/clk-pll.h | 13 ------------ 4 files changed, 24 insertions(+), 47 deletions(-) delete mode 100644 drivers/clk/exynos/clk-pll.c delete mode 100644 drivers/clk/exynos/clk-pll.h
drivers/clk/exynos/Makefile +0 -1
@@ -3,5 +3,4 @@ # Copyright (C) 2016 Samsung Electronics # Thomas Abraham <[email protected]> -obj-y += clk-pll.o obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o
drivers/clk/exynos/clk-exynos7420.c +24 -1
@@ -10,8 +10,15 @@#include <errno.h> #include <clk-uclass.h> #include <asm/io.h> +#include <div64.h> #include <dt-bindings/clock/exynos7420-clk.h> -#include "clk-pll.h" + +#define PLL145X_MDIV_SHIFT 16 +#define PLL145X_MDIV_MASK 0x3ff +#define PLL145X_PDIV_SHIFT 8 +#define PLL145X_PDIV_MASK 0x3f +#define PLL145X_SDIV_SHIFT 0 +#define PLL145X_SDIV_MASK 0x7#define DIVIDER (reg, shift, mask) \ (((readl(reg) >> shift) & mask) + 1)
@@ -64,6 +71,22 @@ struct exynos7420_clk_top0_priv {unsigned long sclk_uart2; }; +static unsigned long pll145x_get_rate (unsigned int *con1, +unsigned long fin_freq) +{ +unsigned long pll_con1 =readl (con1); +unsigned long mdiv, sdiv, pdiv; +u64 fvco = fin_freq; + + mdiv = (pll_con1 >>PLL145X_MDIV_SHIFT ) &PLL145X_MDIV_MASK ; + pdiv = (pll_con1 >>PLL145X_PDIV_SHIFT ) &PLL145X_PDIV_MASK ; + sdiv = (pll_con1 >>PLL145X_SDIV_SHIFT ) &PLL145X_SDIV_MASK ; + + fvco *= mdiv; +do_div (fvco, (pdiv << sdiv)); +return (unsigned long )fvco; +} +static ulong exynos7420_topc_get_rate (struct clk *clk) {struct exynos7420_clk_topc_priv *priv =dev_get_priv (clk->dev);
drivers/clk/exynos/clk-pll.c deleted +0 -32
@@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Exynos PLL helper functions for clock drivers. -* Copyright (C) 2016 Samsung Electronics -* Thomas Abraham <[email protected]> -*/ - -#include <common.h> -#include <asm/io.h> -#include <div64.h> - -#define PLL145X_MDIV_SHIFT 16 -#define PLL145X_MDIV_MASK 0x3ff -#define PLL145X_PDIV_SHIFT 8 -#define PLL145X_PDIV_MASK 0x3f -#define PLL145X_SDIV_SHIFT 0 -#define PLL145X_SDIV_MASK 0x7 - -unsigned long pll145x_get_rate (unsigned int *con1,unsigned long fin_freq) -{ -unsigned long pll_con1 =readl (con1); -unsigned long mdiv, sdiv, pdiv; -uint64_t fvco = fin_freq; - - mdiv = (pll_con1 >>PLL145X_MDIV_SHIFT ) &PLL145X_MDIV_MASK ; - pdiv = (pll_con1 >>PLL145X_PDIV_SHIFT ) &PLL145X_PDIV_MASK ; - sdiv = (pll_con1 >>PLL145X_SDIV_SHIFT ) &PLL145X_SDIV_MASK ; - - fvco *= mdiv; -do_div (fvco, (pdiv << sdiv)); -return (unsigned long )fvco; -}
drivers/clk/exynos/clk-pll.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* Exynos PLL helper functions for clock drivers. -* Copyright (C) 2016 Samsung Electronics -* Thomas Abraham <[email protected]> -*/ - -#ifndef __EXYNOS_CLK_PLL_H -#define __EXYNOS_CLK_PLL_H - -unsigned long pll145x_get_rate (unsigned int *con1,unsigned long fin_freq); - -#endif /* __EXYNOS_CLK_PLL_H */
Signature · 1 line
2.39.2
RE: [PATCH 06/13] clk: exynos: Move pll code into clk-exynos7420
Quoted 9 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 06/13] clk: exynos: Move pll code into clk-exynos7420
Quoted 5 lines
PLL utilities code is only used by clk-exynos7420 driver at the moment. Move it into clk-exynos7420 to make
clk-pll.cfile available for CCF PLL clocks implementation, which is coming in the next patches.Signed-off-by Sam Protsenko <[email protected]>
Sam Protsenko
maintainerPATCH 7/13 clk: exynos: Add Samsung clock framework
In reply to Sam ProtsenkoHeavily based on Linux kernel Samsung clock framework, with some changes to accommodate the differences in U-Boot CCF implementation. It's also quite minimal as compared to the Linux version.
--- drivers/clk/exynos/Makefile | 9 +- drivers/clk/exynos/clk-pll.c | 167 +++++++++++++++++++++++++ drivers/clk/exynos/clk-pll.h | 23 ++++ drivers/clk/exynos/clk.c | 121 +++++++++++++++++++ drivers/clk/exynos/clk.h | 228 +++++++++++++++++++++++++++++++++++ 5 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/exynos/clk-pll.c create mode 100644 drivers/clk/exynos/clk-pll.h create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.h
drivers/clk/exynos/Makefile +7 -2
@@ -1,6 +1,11 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2016 Samsung Electronics -# Thomas Abraham <[email protected]> +# Copyright (C) 2023 Linaro Ltd. +# +# Authors: +# Thomas Abraham <[email protected]> +# Sam Protsenko <[email protected]> -obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o +obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-pll.o +obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o
drivers/clk/exynos/clk-pll.c new file +167 -0
167 lines not on this page · raw message
drivers/clk/exynos/clk-pll.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]> +* Sam Protsenko <[email protected]> +* +* Common Clock Framework support for all PLL's in Samsung platforms. +*/ + +#ifndef __EXYNOS_CLK_PLL_H +#define __EXYNOS_CLK_PLL_H + +#include <linux/clk-provider.h> + +enum samsung_pll_type { + pll_0822x, + pll_0831x, +}; + +#endif /* __EXYNOS_CLK_PLL_H */
drivers/clk/exynos/clk.c new file +121 -0
121 lines not on this page · raw message
drivers/clk/exynos/clk.h new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH 07/13] clk: exynos: Add Samsung clock framework
Quoted 50 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 07/13] clk: exynos: Add Samsung clock frameworkHeavily based on Linux kernel Samsung clock framework, with some changes to accommodate the differences in U-Boot CCF implementation. It's also quite minimal as compared to the Linux version.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/clk/exynos/Makefile | 9 +- drivers/clk/exynos/clk-pll.c | 167 +++++++++++++++++++++++++ drivers/clk/exynos/clk-pll.h | 23 ++++ drivers/clk/exynos/clk.c | 121 +++++++++++++++++++ drivers/clk/exynos/clk.h | 228 +++++++++++++++++++++++++++++++++++ 5 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/exynos/clk-pll.c create mode 100644 drivers/clk/exynos/clk-pll.h create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.hdrivers/clk/exynos/Makefile +7
-2@@ -1,6 +1,11 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2016 Samsung Electronics -# Thomas Abraham <[email protected]> +# Copyright (C) 2023 Linaro Ltd. +# +# Authors: +# Thomas Abraham <[email protected]> +# Sam Protsenko <[email protected]> -obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o +obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-pll.o +obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.odrivers/clk/exynos/clk-pll.c new file +0
-0
drivers/clk/exynos/clk-pll.c line 7
Quoted 7 lines
drivers/clk/exynos/clk-pll.c new file +7
-0@@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]>
Need to correct Thomas's email to samsung.com if you want to keep his original credit even though his e-mail was already stale since he left the company.
Quoted 86 lines
drivers/clk/exynos/clk-pll.c new file +81
-0+* Sam Protsenko <[email protected]> +* +* This file contains the utility functions to register the pll clocks. +*/ + +#include <asm/io.h> +#include <div64.h> +#include <malloc.h> +#include <clk-uclass.h> +#include <dm/device.h> +#include <clk.h> +#include "clk.h" + +#define UBOOT_DM_CLK_SAMSUNG_PLL0822X "samsung_clk_pll0822x" +#define UBOOT_DM_CLK_SAMSUNG_PLL0831X "samsung_clk_pll0831x" + +struct samsung_clk_pll { +struct clk clk; +void __iomem *con_reg; +enum samsung_pll_type type; +}; + +#define to_clk_pll (_clk) container_of(_clk, struct samsung_clk_pll, clk) + +/* +* PLL0822x Clock Type +*/ + +#define PLL0822X_MDIV_MASK 0x3ff +#define PLL0822X_PDIV_MASK 0x3f +#define PLL0822X_SDIV_MASK 0x7 +#define PLL0822X_MDIV_SHIFT 16 +#define PLL0822X_PDIV_SHIFT 8 +#define PLL0822X_SDIV_SHIFT 0 + +static unsigned long samsung_pll0822x_recalc_rate (struct clk *clk) +{ +struct samsung_clk_pll *pll =to_clk_pll (clk); +u32 mdiv, pdiv, sdiv, pll_con3; +u64 fvco =clk_get_parent_rate (clk); + + pll_con3 =readl_relaxed (pll->con_reg); + mdiv = (pll_con3 >>PLL0822X_MDIV_SHIFT ) &PLL0822X_MDIV_MASK ; + pdiv = (pll_con3 >>PLL0822X_PDIV_SHIFT ) &PLL0822X_PDIV_MASK ; + sdiv = (pll_con3 >>PLL0822X_SDIV_SHIFT ) &PLL0822X_SDIV_MASK ; + + fvco *= mdiv; +do_div (fvco, (pdiv << sdiv)); +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll0822x_clk_min_ops = { + .get_rate = samsung_pll0822x_recalc_rate, +}; + +/* +* PLL0831x Clock Type +*/ + +#define PLL0831X_KDIV_MASK 0xffff +#define PLL0831X_MDIV_MASK 0x1ff +#define PLL0831X_PDIV_MASK 0x3f +#define PLL0831X_SDIV_MASK 0x7 +#define PLL0831X_MDIV_SHIFT 16 +#define PLL0831X_PDIV_SHIFT 8 +#define PLL0831X_SDIV_SHIFT 0 +#define PLL0831X_KDIV_SHIFT 0 + +static unsigned long samsung_pll0831x_recalc_rate (struct clk *clk) +{ +struct samsung_clk_pll *pll =to_clk_pll (clk); +u32 mdiv, pdiv, sdiv, pll_con3, pll_con5; +s16 kdiv; +u64 fvco =clk_get_parent_rate (clk); + + pll_con3 =readl_relaxed (pll->con_reg); + pll_con5 =readl_relaxed (pll->con_reg +8 ); + mdiv = (pll_con3 >>PLL0831X_MDIV_SHIFT ) &PLL0831X_MDIV_MASK ; + pdiv = (pll_con3 >>PLL0831X_PDIV_SHIFT ) &PLL0831X_PDIV_MASK ; + sdiv = (pll_con3 >>PLL0831X_SDIV_SHIFT ) &PLL0831X_SDIV_MASK ; + kdiv = (s16)((pll_con5 >> PLL0831X_KDIV_SHIFT) &
PLL0831X_KDIV_MASK);drivers/clk/exynos/clk-pll.c new file +4
-0+ + fvco *= (mdiv <<16 ) + kdiv; +do_div (fvco, (pdiv << sdiv)); + fvco >>=16 ;
drivers/clk/exynos/clk-pll.c
Quoted 10 lines
drivers/clk/exynos/clk-pll.c new file +10
-0+ +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll0831x_clk_min_ops = { + .get_rate = samsung_pll0831x_recalc_rate, +}; + +static struct clk *_samsung_clk_register_pll (void __iomem *base, + const struct samsung_pll_clock
*pll_clk)
Quoted 72 lines
drivers/clk/exynos/clk-pll.c new file +28
-0+{ +struct samsung_clk_pll *pll; +struct clk *clk; +const char *drv_name; +int ret; + + pll =kzalloc (sizeof (*pll),GFP_KERNEL ); +if (!pll) +return ERR_PTR (-ENOMEM ); + + pll->con_reg = base + pll_clk->con_offset; + pll->type = pll_clk->type; + clk = &pll->clk; + clk->flags = pll_clk->flags; + +switch (pll_clk->type) { +case pll_0822x: + drv_name =UBOOT_DM_CLK_SAMSUNG_PLL0822X ; +break ; +case pll_0831x: + drv_name =UBOOT_DM_CLK_SAMSUNG_PLL0831X ; +break ; +default : +kfree (pll); +return ERR_PTR (-ENODEV ); + } + + ret = clk_register(clk, drv_name, pll_clk->name, pll_clk-Quoted 1 line
parent_name);drivers/clk/exynos/clk-pll.c new file +37
-0+if (ret) { +kfree (pll); +return ERR_PTR (ret); + } + +return clk; +} + +void samsung_clk_register_pll (void __iomem *base, +const struct samsung_pll_clock *clk_list, +unsigned int nr_clk) +{ +unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_pll_clock *pll_clk; + + pll_clk = &clk_list[cnt]; + clk =_samsung_clk_register_pll (base, pll_clk); +clk_dm (pll_clk->id, clk); + } +} + +U_BOOT_DRIVER (samsung_pll0822x_clk) = { + .name =UBOOT_DM_CLK_SAMSUNG_PLL0822X , + .id =UCLASS_CLK , + .ops = &samsung_pll0822x_clk_min_ops, + .flags =DM_FLAG_PRE_RELOC , +}; + +U_BOOT_DRIVER (samsung_pll0831x_clk) = { + .name =UBOOT_DM_CLK_SAMSUNG_PLL0831X , + .id =UCLASS_CLK , + .ops = &samsung_pll0831x_clk_min_ops, + .flags =DM_FLAG_PRE_RELOC , +};drivers/clk/exynos/clk-pll.h new file +0
-0
drivers/clk/exynos/clk-pll.h line 7
Quoted 7 lines
drivers/clk/exynos/clk-pll.h new file +7
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]>
Ditto.
Othewise,
Sam Protsenko
maintainerRe: [PATCH 07/13] clk: exynos: Add Samsung clock framework
Quoted 1 line · Chanho Park
[snip]
Quoted 9 lines
Quoted 9 lines
drivers/clk/exynos/clk-pll.c new file +3
-0@@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2016 Samsung Electronics
Quoted 9 lines
drivers/clk/exynos/clk-pll.c line 7
Quoted 4 lines
drivers/clk/exynos/clk-pll.c new file +4
-0+* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]> Need to correct Thomas's email to samsung.com if you want to keep his original credit even though his e-mail was already stale since he left the company.
Thanks for the review, will do in v2!
[snip]
Quoted 9 lines
drivers/clk/exynos/clk-pll.c line 7
Quoted 3 lines
drivers/clk/exynos/clk-pll.c new file +3
-0+* +* Authors: +* Thomas Abraham <[email protected]> Ditto.
Othewise,
Reviewed-by Chanho Park <[email protected]>
Re: [PATCH 07/13] clk: exynos: Add Samsung clock framework
In reply to Sam ProtsenkoHi,
2023년 12월 13일 (수) 12:27, Sam Protsenko <[email protected]>님이 작성:
Quoted 227 lines
Heavily based on Linux kernel Samsung clock framework, with some changes to accommodate the differences in U-Boot CCF implementation. It's also quite minimal as compared to the Linux version.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/clk/exynos/Makefile | 9 +- drivers/clk/exynos/clk-pll.c | 167 +++++++++++++++++++++++++ drivers/clk/exynos/clk-pll.h | 23 ++++ drivers/clk/exynos/clk.c | 121 +++++++++++++++++++ drivers/clk/exynos/clk.h | 228 +++++++++++++++++++++++++++++++++++ 5 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/exynos/clk-pll.c create mode 100644 drivers/clk/exynos/clk-pll.h create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.hdrivers/clk/exynos/Makefile +7
-2@@ -1,6 +1,11 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2016 Samsung Electronics -# Thomas Abraham <[email protected]> +# Copyright (C) 2023 Linaro Ltd. +# +# Authors: +# Thomas Abraham <[email protected]> +# Sam Protsenko <[email protected]> -obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o +obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-pll.o +obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.odrivers/clk/exynos/clk-pll.c new file +88
-0@@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]> +* Sam Protsenko <[email protected]> +* +* This file contains the utility functions to register the pll clocks. +*/ + +#include <asm/io.h> +#include <div64.h> +#include <malloc.h> +#include <clk-uclass.h> +#include <dm/device.h> +#include <clk.h> +#include "clk.h" + +#define UBOOT_DM_CLK_SAMSUNG_PLL0822X "samsung_clk_pll0822x" +#define UBOOT_DM_CLK_SAMSUNG_PLL0831X "samsung_clk_pll0831x" + +struct samsung_clk_pll { +struct clk clk; +void __iomem *con_reg; +enum samsung_pll_type type; +}; + +#define to_clk_pll (_clk) container_of(_clk, struct samsung_clk_pll, clk) + +/* +* PLL0822x Clock Type +*/ + +#define PLL0822X_MDIV_MASK 0x3ff +#define PLL0822X_PDIV_MASK 0x3f +#define PLL0822X_SDIV_MASK 0x7 +#define PLL0822X_MDIV_SHIFT 16 +#define PLL0822X_PDIV_SHIFT 8 +#define PLL0822X_SDIV_SHIFT 0 + +static unsigned long samsung_pll0822x_recalc_rate (struct clk *clk) +{ +struct samsung_clk_pll *pll =to_clk_pll (clk); +u32 mdiv, pdiv, sdiv, pll_con3; +u64 fvco =clk_get_parent_rate (clk); + + pll_con3 =readl_relaxed (pll->con_reg); + mdiv = (pll_con3 >>PLL0822X_MDIV_SHIFT ) &PLL0822X_MDIV_MASK ; + pdiv = (pll_con3 >>PLL0822X_PDIV_SHIFT ) &PLL0822X_PDIV_MASK ; + sdiv = (pll_con3 >>PLL0822X_SDIV_SHIFT ) &PLL0822X_SDIV_MASK ; + + fvco *= mdiv; +do_div (fvco, (pdiv << sdiv)); +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll0822x_clk_min_ops = { + .get_rate = samsung_pll0822x_recalc_rate, +}; + +/* +* PLL0831x Clock Type +*/ + +#define PLL0831X_KDIV_MASK 0xffff +#define PLL0831X_MDIV_MASK 0x1ff +#define PLL0831X_PDIV_MASK 0x3f +#define PLL0831X_SDIV_MASK 0x7 +#define PLL0831X_MDIV_SHIFT 16 +#define PLL0831X_PDIV_SHIFT 8 +#define PLL0831X_SDIV_SHIFT 0 +#define PLL0831X_KDIV_SHIFT 0 + +static unsigned long samsung_pll0831x_recalc_rate (struct clk *clk) +{ +struct samsung_clk_pll *pll =to_clk_pll (clk); +u32 mdiv, pdiv, sdiv, pll_con3, pll_con5; +s16 kdiv; +u64 fvco =clk_get_parent_rate (clk); + + pll_con3 =readl_relaxed (pll->con_reg); + pll_con5 =readl_relaxed (pll->con_reg +8 ); + mdiv = (pll_con3 >>PLL0831X_MDIV_SHIFT ) &PLL0831X_MDIV_MASK ; + pdiv = (pll_con3 >>PLL0831X_PDIV_SHIFT ) &PLL0831X_PDIV_MASK ; + sdiv = (pll_con3 >>PLL0831X_SDIV_SHIFT ) &PLL0831X_SDIV_MASK ; + kdiv = (s16)((pll_con5 >> PLL0831X_KDIV_SHIFT) &
PLL0831X_KDIV_MASK);drivers/clk/exynos/clk-pll.c new file +14
-0+ + fvco *= (mdiv <<16 ) + kdiv; +do_div (fvco, (pdiv << sdiv)); + fvco >>=16 ; + +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll0831x_clk_min_ops = { + .get_rate = samsung_pll0831x_recalc_rate, +}; + +static struct clk *_samsung_clk_register_pll (void __iomem *base, + const struct samsung_pll_clock
*pll_clk)drivers/clk/exynos/clk-pll.c new file +28
-0+{ +struct samsung_clk_pll *pll; +struct clk *clk; +const char *drv_name; +int ret; + + pll =kzalloc (sizeof (*pll),GFP_KERNEL ); +if (!pll) +return ERR_PTR (-ENOMEM ); + + pll->con_reg = base + pll_clk->con_offset; + pll->type = pll_clk->type; + clk = &pll->clk; + clk->flags = pll_clk->flags; + +switch (pll_clk->type) { +case pll_0822x: + drv_name =UBOOT_DM_CLK_SAMSUNG_PLL0822X ; +break ; +case pll_0831x: + drv_name =UBOOT_DM_CLK_SAMSUNG_PLL0831X ; +break ; +default : +kfree (pll); +return ERR_PTR (-ENODEV ); + } + + ret = clk_register(clk, drv_name, pll_clk->name,
pll_clk->parent_name);drivers/clk/exynos/clk-pll.c new file +37
-0+if (ret) { +kfree (pll); +return ERR_PTR (ret); + } + +return clk; +} + +void samsung_clk_register_pll (void __iomem *base, +const struct samsung_pll_clock *clk_list, +unsigned int nr_clk) +{ +unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_pll_clock *pll_clk; + + pll_clk = &clk_list[cnt]; + clk =_samsung_clk_register_pll (base, pll_clk); +clk_dm (pll_clk->id, clk); + } +} + +U_BOOT_DRIVER (samsung_pll0822x_clk) = { + .name =UBOOT_DM_CLK_SAMSUNG_PLL0822X , + .id =UCLASS_CLK , + .ops = &samsung_pll0822x_clk_min_ops, + .flags =DM_FLAG_PRE_RELOC , +}; + +U_BOOT_DRIVER (samsung_pll0831x_clk) = { + .name =UBOOT_DM_CLK_SAMSUNG_PLL0831X , + .id =UCLASS_CLK , + .ops = &samsung_pll0831x_clk_min_ops, + .flags =DM_FLAG_PRE_RELOC , +};drivers/clk/exynos/clk-pll.h new file +10
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]> +* Sam Protsenko <[email protected]> +* +* Common Clock Framework support for all PLL's in Samsung platforms.
drivers/clk/exynos/clk-pll.h line 20
Quoted 10 lines
drivers/clk/exynos/clk-pll.h new file +10
-0+*/ + +#ifndef __EXYNOS_CLK_PLL_H +#define __EXYNOS_CLK_PLL_H + +#include <linux/clk-provider.h> + +enum samsung_pll_type { + pll_0822x, + pll_0831x,
why don't you modify to uppercase?
Quoted 20 lines
drivers/clk/exynos/clk-pll.h new file +3
-0+}; + +#endif /* __EXYNOS_CLK_PLL_H */ drivers/clk/exynos/clk.c new file +11
-0@@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2023 Linaro Ltd. +* Sam Protsenko <[email protected]> +* +* This file includes utility functions to register clocks to common +* clock framework for Samsung platforms. +*/ + +#include <dm.h> +#include "clk.h"
drivers/clk/exynos/clk.c line 21
Quoted 10 lines
drivers/clk/exynos/clk.c new file +10
-0+ +void samsung_clk_register_mux (void __iomem *base, +const struct samsung_mux_clock *clk_list, +unsigned int nr_clk) +{ +unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_mux_clock *m;
wouldn't it be better if use a more meaningful name like mux?
drivers/clk/exynos/clk.c line 23
Quoted 2 lines
drivers/clk/exynos/clk.c new file +2
-0+ + m = &clk_list[cnt];
Is there any possibility that the value is null or wrong (e.g. overflow)
Quoted 344 lines
drivers/clk/exynos/clk.c new file +2
-0+ clk = clk_register_mux(NULL, m->name, m->parent_names, + m->num_parents, m->flags, base + m->offset,
m->shift,drivers/clk/exynos/clk.c new file +47
-0+ m->width, m->mux_flags); +clk_dm (m->id, clk); + } +} + +void samsung_clk_register_div (void __iomem *base, +const struct samsung_div_clock *clk_list, +unsigned int nr_clk) +{ +unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_div_clock *d; + + d = &clk_list[cnt]; + clk =clk_register_divider (NULL , d->name, d->parent_name, + d->flags, base + d->offset, d->shift, + d->width, d->div_flags); +clk_dm (d->id, clk); + } +} + +void samsung_clk_register_gate (void __iomem *base, +const struct samsung_gate_clock *clk_list, +unsigned int nr_clk) +{ +unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_gate_clock *g; + + g = &clk_list[cnt]; + clk =clk_register_gate (NULL , g->name, g->parent_name, + g->flags, base + g->offset, g->bit_idx, + g->gate_flags,NULL ); +clk_dm (g->id, clk); + } +} + +typedef void (*samsung_clk_register_fn )(void __iomem *base, +const void *clk_list, +unsigned int nr_clk); + +static const samsung_clk_register_fn samsung_clk_register_fns[] = { + [S_CLK_MUX] =(samsung_clk_register_fn)samsung_clk_register_mux,
+ [S_CLK_DIV] =
(samsung_clk_register_fn)samsung_clk_register_div,
+ [S_CLK_GATE] =
(samsung_clk_register_fn)samsung_clk_register_gate,
+ [S_CLK_PLL] =
(samsung_clk_register_fn)samsung_clk_register_pll,drivers/clk/exynos/clk.c new file +9
-0+}; + +/** +* samsung_cmu_register_clocks() - Register provided clock groups +* @base: Base address of CMU registers +* @clk_groups: list of clock groups +* @nr_groups: count of clock groups in @clk_groups +* +* Having the array of clock groups @clk_groups makes it possible to keep a
+ * correct clocks registration order.
+ */drivers/clk/exynos/clk.c new file +2
-0+void samsung_cmu_register_clocks (void __iomem *base, + const struct samsung_clk_group
*clk_groups,drivers/clk/exynos/clk.c new file +8
-0+ unsigned int nr_groups) +{ +unsigned int i; + +for (i =0 ; i < nr_groups; i++) { +const struct samsung_clk_group *g = &clk_groups[i]; + + samsung_clk_register_fns[g->type](base, g->clk_list,
g->nr_clk);drivers/clk/exynos/clk.c new file +25
-0+ } +} + +/** +* samsung_cmu_register_one - Register all CMU clocks +* @dev: CMU device +* @clk_groups: list of CMU clock groups +* @nr_groups: count of CMU clock groups in @clk_groups +* +* Return: 0 on success or negative value on error. +*/ +int samsung_cmu_register_one (struct udevice *dev, +const struct samsung_clk_group *clk_groups, +unsigned int nr_groups) +{ +void __iomem *base; + + base =dev_read_addr_ptr (dev); +if (!base) +return -EINVAL ; + +samsung_cmu_register_clocks (base, clk_groups, nr_groups); + +return 0 ; +}drivers/clk/exynos/clk.h new file +196
-0@@ -0,0 +1,228 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2023 Linaro Ltd. +* Sam Protsenko <[email protected]> +* +* Common Clock Framework support for all Samsung platforms. +*/ + +#ifndef __EXYNOS_CLK_H +#define __EXYNOS_CLK_H + +#include <errno.h> +#include <linux/clk-provider.h> +#include "clk-pll.h" + +/** +* struct samsung_mux_clock - information about mux clock +* @id: platform specific id of the clock +* @name: name of this mux clock +* @parent_names: array of pointer to parent clock names +* @num_parents: number of parents listed in @parent_names +* @flags: optional flags for basic clock +* @offset: offset of the register for configuring the mux +* @shift: starting bit location of the mux control bit-field in @reg +* @width: width of the mux control bit-field in @reg +* @mux_flags: flags for mux-type clock +*/ +struct samsung_mux_clock { +unsigned int id; +const char *name; +const char *const *parent_names; +u8 num_parents; +unsigned long flags; +unsigned long offset; +u8 shift; +u8 width; +u8 mux_flags; +}; + +#define PNAME (x) static const char * const x[] + +#define __MUX (_id, cname, pnames, o, s, w, f, mf) \ + { \ + .id = _id, \ + .name = cname, \ + .parent_names = pnames, \ + .num_parents = ARRAY_SIZE(pnames), \ + .flags = (f) | CLK_SET_RATE_NO_REPARENT, \ + .offset = o, \ + .shift = s, \ + .width = w, \ + .mux_flags = mf, \ + } + +#define MUX (_id, cname, pnames, o, s, w) \ + __MUX(_id, cname, pnames, o, s, w, 0, 0) + +#define MUX_F (_id, cname, pnames, o, s, w, f, mf) \ + __MUX(_id, cname, pnames, o, s, w, f, mf) + +/** +* struct samsung_div_clock - information about div clock +* @id: platform specific id of the clock +* @name: name of this div clock +* @parent_name: name of the parent clock +* @flags: optional flags for basic clock +* @offset: offset of the register for configuring the div +* @shift: starting bit location of the div control bit-field in @reg +* @width: width of the bitfield +* @div_flags: flags for div-type clock +*/ +struct samsung_div_clock { +unsigned int id; +const char *name; +const char *parent_name; +unsigned long flags; +unsigned long offset; +u8 shift; +u8 width; +u8 div_flags; +}; + +#define __DIV (_id, cname, pname, o, s, w, f, df) \ + { \ + .id = _id, \ + .name = cname, \ + .parent_name = pname, \ + .flags = f, \ + .offset = o, \ + .shift = s, \ + .width = w, \ + .div_flags = df, \ + } + +#define DIV (_id, cname, pname, o, s, w) \ + __DIV(_id, cname, pname, o, s, w, 0, 0) + +#define DIV_F (_id, cname, pname, o, s, w, f, df) \ + __DIV(_id, cname, pname, o, s, w, f, df) + +/** +* struct samsung_gate_clock - information about gate clock +* @id: platform specific id of the clock +* @name: name of this gate clock +* @parent_name: name of the parent clock +* @flags: optional flags for basic clock +* @offset: offset of the register for configuring the gate +* @bit_idx: bit index of the gate control bit-field in @reg +* @gate_flags: flags for gate-type clock +*/ +struct samsung_gate_clock { +unsigned int id; +const char *name; +const char *parent_name; +unsigned long flags; +unsigned long offset; +u8 bit_idx; +u8 gate_flags; +}; + +#define __GATE (_id, cname, pname, o, b, f, gf) \ + { \ + .id = _id, \ + .name = cname, \ + .parent_name = pname, \ + .flags = f, \ + .offset = o, \ + .bit_idx = b, \ + .gate_flags = gf, \ + } + +#define GATE (_id, cname, pname, o, b, f, gf) \ + __GATE(_id, cname, pname, o, b, f, gf) + +/** +* struct samsung_pll_clock - information about pll clock +* @id: platform specific id of the clock +* @name: name of this pll clock +* @parent_name: name of the parent clock +* @flags: optional flags for basic clock +* @con_offset: offset of the register for configuring the PLL +* @type: type of PLL to be registered +*/ +struct samsung_pll_clock { +unsigned int id; +const char *name; +const char *parent_name; +unsigned long flags; +int con_offset; +enum samsung_pll_type type; +}; + +#define PLL (_typ, _id, _name, _pname, _con) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .flags = CLK_GET_RATE_NOCACHE, \ + .con_offset = _con, \ + .type = _typ, \ + } + +enum samsung_clock_type { +S_CLK_MUX , +S_CLK_DIV , +S_CLK_GATE , +S_CLK_PLL , +}; + +/** +* struct samsung_clock_group - contains a list of clocks of one type +* @type: type of clocks this structure contains +* @clk_list: list of clocks +* @nr_clk: count of clocks in @clk_list +*/ +struct samsung_clk_group { +enum samsung_clock_type type; +const void *clk_list; +unsigned int nr_clk; +}; + +void samsung_clk_register_mux (void __iomem *base, +const struct samsung_mux_clock *clk_list, +unsigned int nr_clk); +void samsung_clk_register_div (void __iomem *base, +const struct samsung_div_clock *clk_list, +unsigned int nr_clk); +void samsung_clk_register_gate (void __iomem *base, +const struct samsung_gate_clock *clk_list, +unsigned int nr_clk); +void samsung_clk_register_pll (void __iomem *base, +const struct samsung_pll_clock *clk_list, +unsigned int nr_clk); + +void samsung_cmu_register_clocks (void __iomem *base, + const struct samsung_clk_group
*clk_groups,drivers/clk/exynos/clk.h new file +7
-0+ unsigned int nr_groups); +int samsung_cmu_register_one (struct udevice *dev, +const struct samsung_clk_group *clk_groups, +unsigned int nr_groups); + +/** +* samsung_register_cmu - Register CMU clocks ensuring parent CMU is present
+ * @dev: CMU device
+ * @clk_groups: list of CMU clock groups
+ * @parent_drv: name of parent CMU driver
+ *
+ * Register provided CMU clocks, but make sureCMU_TOPdriver is instantiated
+ * first.
+ *
+ * Return: 0 on success or negative value on error.
+ */drivers/clk/exynos/clk.h new file +16
-1+#define samsung_register_cmu (dev, clk_groups, parent_drv) \ +({ \ + struct udevice *__parent; \ + int __ret; \ + \ + __ret = uclass_get_device_by_driver(UCLASS_CLK, \ + DM_DRIVER_GET(parent_drv), &__parent); \ + if (__ret || !__parent) \ + __ret = -ENOENT; \ + else \ + __ret = samsung_cmu_register_one(dev, clk_groups, \ + ARRAY_SIZE(clk_groups)); \ + __ret; \ +}) + +#endif /* __EXYNOS_CLK_H */ --
Quoted 2 lines
2.39.2
Thanks.
Minkyu Kang.
Sam Protsenko
maintainerRe: [PATCH 07/13] clk: exynos: Add Samsung clock framework
Quoted 12 lines · Minkyu Kang
Hi,
2023년 12월 13일 (수) 12:27, Sam Protsenko <[email protected]>님이 작성:
Quoted 7 lines
Heavily based on Linux kernel Samsung clock framework, with some changes to accommodate the differences in U-Boot CCF implementation. It's also quite minimal as compared to the Linux version.
Signed-off-by Sam Protsenko <[email protected]>---
[snip]
Quoted 21 lines
Quoted 21 lines
drivers/clk/exynos/clk-pll.h new file +15
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2016 Samsung Electronics +* Copyright (C) 2023 Linaro Ltd. +* +* Authors: +* Thomas Abraham <[email protected]> +* Sam Protsenko <[email protected]> +* +* Common Clock Framework support for all PLL's in Samsung platforms. +*/ + +#ifndef __EXYNOS_CLK_PLL_H +#define __EXYNOS_CLK_PLL_H +
Quoted 9 lines
drivers/clk/exynos/clk-pll.h line 20
Quoted 5 lines
drivers/clk/exynos/clk-pll.h new file +5
-0+#include <linux/clk-provider.h> + +enum samsung_pll_type { + pll_0822x, + pll_0831x,why don't you modify to uppercase?
That code was basically copied over from Linux kernel (from drivers/clk/samsung/clk-pll.h file). I'm trying to keep it as close to the original as possible, to ease any possible backporting in future. Although kernel coding style indeed tends to stick to uppercase in enums, in my opinion the backporting/compatibility concern outweighs the style one. Hope it's ok with you if I keep it as is in v2?
Quoted 26 lines
Quoted 26 lines
drivers/clk/exynos/clk-pll.h new file +3
-0+}; + +#endif /* __EXYNOS_CLK_PLL_H */ drivers/clk/exynos/clk.c new file +16
-0@@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2023 Linaro Ltd. +* Sam Protsenko <[email protected]> +* +* This file includes utility functions to register clocks to common +* clock framework for Samsung platforms. +*/ + +#include <dm.h> +#include "clk.h" + +void samsung_clk_register_mux (void __iomem *base, +const struct samsung_mux_clock *clk_list, +unsigned int nr_clk) +{
Quoted 9 lines
drivers/clk/exynos/clk.c line 21
Quoted 5 lines
drivers/clk/exynos/clk.c new file +5
-0+unsigned int cnt; + +for (cnt =0 ; cnt < nr_clk; cnt++) { +struct clk *clk; +const struct samsung_mux_clock *m;wouldn't it be better if use a more meaningful name like mux?
My reasoning for choosing the name that short in this case was because of super-short scope (3 lines of code), and OTOH this variable is massively used during that scope, like this:
clk = clk_register_mux(NULL, m->name, m->parent_names,
m->num_parents, m->flags, base + m->offset, m->shift,
m->width, m->mux_flags);Hope it makes sense. If you still prefer 'mux', please let me know and I'll use it in v2.
Quoted 7 lines
drivers/clk/exynos/clk.c line 23
Quoted 3 lines
drivers/clk/exynos/clk.c new file +2
-0+ + m = &clk_list[cnt];Is there any possibility that the value is null or wrong (e.g. overflow)
I decided to keep it with no error handling because I didn't feel like it would bring much value. Because this code is supposed to be used via samsung_cmu_register_one(), and the CMU structure passed to that function is usually going to be defined in this idiomatic way (as can be seen in clk-exynos850.c driver):
static const struct samsung_clk_group top_cmu_clks[] = {
{ S_CLK_PLL, top_pure_pll_clks, ARRAY_SIZE(top_pure_pll_clks) }, { S_CLK_MUX, top_pure_mux_clks, ARRAY_SIZE(top_pure_mux_clks) },
...
and the corresponding clocks structures are also defined like this:
static const struct samsung_mux_clock top_pure_mux_clks[] = {
MUX(CLK_MOUT_SHARED0_PLL, "mout_shared0_pll",
mout_shared0_pll_p,
PLL_CON0_PLL_SHARED0, 4, 1),
MUX(CLK_MOUT_SHARED1_PLL, "mout_shared1_pll",
mout_shared1_pll_p,
PLL_CON0_PLL_SHARED1, 4, 1),
...I'd say the odds for messing this up are next to none, because of using ARRAY_SIZE() and clock macros like MUX(). Especially because the example is already set in clk-exynos850 driver and I assume everybody would just use it as a template, which usually happens. So after exploring the alternative approach (with added error handling) I felt it was unjustifiable cluttered comparing to the more concise version present in this series, at least in this particular code. Also, that code resembles its kernel counterpart, where the clock pointer isn't checked as well.
I'm not even sure how to handle possible errors here, as it's the critical platform code. So maybe letting it just crash is not a bad decision too. But if you have a strong opinion on this one, please let me know how you would like me to handle that.
Quoted 6 lines
Quoted 6 lines
drivers/clk/exynos/clk.c new file +5
-0+ clk =clk_register_mux (NULL , m->name, m->parent_names, + m->num_parents, m->flags, base + m->offset, m->shift, + m->width, m->mux_flags); +clk_dm (m->id, clk); + }Quoted 1 line
+}
[snip]
Sam Protsenko
maintainerPATCH 8/13 clk: exynos: Add Exynos850 clock driver
In reply to Sam ProtsenkoHeavily influenced by its Linux kernel counterpart. It's implemented on top of recently added Samsung CCF clock framework API. For now only UART leaf clocks are implemented, along with all preceding clocks in CMU_TOP and CMU_PERI. The UART baud clock is required in the serial driver, to get its rate for the consequent baud rate calculation.
--- drivers/clk/exynos/Kconfig | 7 ++ drivers/clk/exynos/Makefile | 1 + drivers/clk/exynos/clk-exynos850.c | 189 +++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 drivers/clk/exynos/clk-exynos850.c
drivers/clk/exynos/Kconfig +7 -0
@@ -15,4 +15,11 @@ config CLK_EXYNOS7420 This enables common clock driver support for platforms based on Samsung Exynos7420 SoC. +config CLK_EXYNOS850 + bool "Clock driver for Samsung's Exynos850 SoC" + select CLK_CCF + help + This enables common clock driver support for platforms based + on Samsung Exynos850 SoC. + endmenu
drivers/clk/exynos/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-pll.o obj-$(CONFIG_CLK_EXYNOS7420) += clk-exynos7420.o +obj-$(CONFIG_CLK_EXYNOS850) += clk-exynos850.o
drivers/clk/exynos/clk-exynos850.c new file +189 -0
189 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH 08/13] clk: exynos: Add Exynos850 clock driver
Quoted 9 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 08/13] clk: exynos: Add Exynos850 clock driver
Quoted 7 lines
Heavily influenced by its Linux kernel counterpart. It's implemented on top of recently added Samsung CCF clock framework API. For now only UART leaf clocks are implemented, along with all preceding clocks in
CMU_TOPandCMU_PERI. The UART baud clock is required in the serial driver, to get its rate for the consequent baud rate calculation.Signed-off-by Sam Protsenko <[email protected]>
Sam Protsenko
maintainerPATCH 9/13 pinctrl: exynos: Add pinctrl support for Exynos850
In reply to Sam ProtsenkoAdd pinctrl support for Exynos850 SoC. It was mostly extracted from corresponding Linux kernel code [1]. Power down modes and external interrupt data were removed while converting the code for U-Boot, but everything else was kept almost unchanged.
[1] drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
--- drivers/pinctrl/exynos/Kconfig | 8 ++ drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 +++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.c
drivers/pinctrl/exynos/Kconfig +8 -0
@@ -16,3 +16,11 @@ config PINCTRL_EXYNOS78x0 help Support pin multiplexing and pin configuration control on Samsung's Exynos78x0 SoC. + +config PINCTRL_EXYNOS850 + bool "Samsung Exynos850 pinctrl driver" + depends on ARCH_EXYNOS && PINCTRL_FULL + select PINCTRL_EXYNOS + help + Support pin multiplexing and pin configuration control on + Samsung's Exynos850 SoC.
drivers/pinctrl/exynos/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o obj-$(CONFIG_PINCTRL_EXYNOS7420) += pinctrl-exynos7420.o obj-$(CONFIG_PINCTRL_EXYNOS78x0) += pinctrl-exynos78x0.o +obj-$(CONFIG_PINCTRL_EXYNOS850) += pinctrl-exynos850.o
drivers/pinctrl/exynos/pinctrl-exynos850.c new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH 09/13] pinctrl: exynos: Add pinctrl support for Exynos850
Quoted 58 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 09/13] pinctrl: exynos: Add pinctrl support for Exynos850Add pinctrl support for Exynos850 SoC. It was mostly extracted from corresponding Linux kernel code [1]. Power down modes and external interrupt data were removed while converting the code for U-Boot, but everything else was kept almost unchanged.
[1]
drivers/pinctrl/samsung/pinctrl-exynos-arm64.cSigned-off-by Sam Protsenko <[email protected]>--- drivers/pinctrl/exynos/Kconfig | 8 ++ drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 +++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.cdrivers/pinctrl/exynos/Kconfig +8
-0@@ -16,3 +16,11 @@ config PINCTRL_EXYNOS78x0 help Support pin multiplexing and pin configuration control on Samsung's Exynos78x0 SoC. + +config PINCTRL_EXYNOS850 + bool "Samsung Exynos850 pinctrl driver" + depends on ARCH_EXYNOS && PINCTRL_FULL + select PINCTRL_EXYNOS + help + Support pin multiplexing and pin configuration control on + Samsung's Exynos850 SoC.drivers/pinctrl/exynos/Makefile +1
-0@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o obj-$(CONFIG_PINCTRL_EXYNOS7420) += pinctrl-exynos7420.o obj-$(CONFIG_PINCTRL_EXYNOS78x0) += pinctrl-exynos78x0.o +obj-$(CONFIG_PINCTRL_EXYNOS850) += pinctrl-exynos850.odrivers/pinctrl/exynos/pinctrl-exynos850.c new file +0
-0
drivers/pinctrl/exynos/pinctrl-exynos850.c line 6
Quoted 6 lines
drivers/pinctrl/exynos/pinctrl-exynos850.c new file +6
-0@@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 Linaro Ltd. +* Author: Sam Protsenko <[email protected]> +* +* Samsung Exynos USI driver (Universal Serial Interface).
Typo. It should be a subject for the pinctrl driver.
Otherwise,
Sam Protsenko
maintainerRe: [PATCH 09/13] pinctrl: exynos: Add pinctrl support for Exynos850
Quoted 59 lines · Chanho Park
Quoted 59 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Sam Protsenko
Sent: Wednesday, December 13, 2023 12:17 PM
To: Minkyu Kang <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: [PATCH 09/13] pinctrl: exynos: Add pinctrl support for Exynos850Add pinctrl support for Exynos850 SoC. It was mostly extracted from corresponding Linux kernel code [1]. Power down modes and external interrupt data were removed while converting the code for U-Boot, but everything else was kept almost unchanged.
[1]
drivers/pinctrl/samsung/pinctrl-exynos-arm64.cSigned-off-by Sam Protsenko <[email protected]>--- drivers/pinctrl/exynos/Kconfig | 8 ++ drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 +++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.cdrivers/pinctrl/exynos/Kconfig +8
-0@@ -16,3 +16,11 @@ config PINCTRL_EXYNOS78x0 help Support pin multiplexing and pin configuration control on Samsung's Exynos78x0 SoC. + +config PINCTRL_EXYNOS850 + bool "Samsung Exynos850 pinctrl driver" + depends on ARCH_EXYNOS && PINCTRL_FULL + select PINCTRL_EXYNOS + help + Support pin multiplexing and pin configuration control on + Samsung's Exynos850 SoC.drivers/pinctrl/exynos/Makefile +1
-0@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o obj-$(CONFIG_PINCTRL_EXYNOS7420) += pinctrl-exynos7420.o obj-$(CONFIG_PINCTRL_EXYNOS78x0) += pinctrl-exynos78x0.o +obj-$(CONFIG_PINCTRL_EXYNOS850) += pinctrl-exynos850.odrivers/pinctrl/exynos/pinctrl-exynos850.c new file +0
-0@@ -0,0 +1,125 @@
Quoted 9 lines
drivers/pinctrl/exynos/pinctrl-exynos850.c line 6
Quoted 6 lines
drivers/pinctrl/exynos/pinctrl-exynos850.c new file +6
-0+// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 Linaro Ltd. +* Author: Sam Protsenko <[email protected]> +* +* Samsung Exynos USI driver (Universal Serial Interface). Typo. It should be a subject for the pinctrl driver.
Nice catch! Will be fixed in v2.
Quoted 2 lines
Otherwise,
Reviewed-by Chanho Park <[email protected]>
Thanks for the review!
Quoted 1 line
Sam Protsenko
maintainerPATCH 10/13 serial: s5p: Add Exynos850 compatible
In reply to Sam ProtsenkoEnable serial support for Exynos850 SoC by adding the corresponding compatible string. No additional changes needed, the driver works as is on Exynos850. Related USI and PMU configuration is enabled in separate drivers. The only other dependencies are clock and pinctrl drivers, which are already enabled too.
--- drivers/serial/serial_s5p.c | 1 + 1 file changed, 1 insertion(+)
drivers/serial/serial_s5p.c +1 -0
@@ -257,6 +257,7 @@ static const struct dm_serial_ops s5p_serial_ops = {static const struct udevice_id s5p_serial_ids[] = { { .compatible ="samsung,exynos4210-uart" , .data =PORT_S5P }, + { .compatible ="samsung,exynos850-uart" , .data =PORT_S5P }, { .compatible ="apple,s5l-uart" , .data =PORT_S5L }, { } };
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 11/13 arm: exynos: Add Exynos850 SoC support
In reply to Sam ProtsenkoSamsung Exynos850 is ARMv8-based mobile-oriented SoC. It features Cortex-A55 CPU (8 cores) and it's built using 8nm process.
Add Exynos850 support by enabling next features:
* Import Exynos850 SoC dtsi files from Linux kernel
* Add Exynos850 MMU memory map
* Introduce ARCH_EXYNOS9 platform config option
--- arch/arm/dts/exynos-pinctrl.h | 79 +++ arch/arm/dts/exynos850-pinctrl.dtsi | 663 +++++++++++++++++++++++ arch/arm/dts/exynos850.dtsi | 809 ++++++++++++++++++++++++++++ arch/arm/mach-exynos/Kconfig | 9 + arch/arm/mach-exynos/mmu-arm64.c | 34 ++ 5 files changed, 1594 insertions(+) create mode 100644 arch/arm/dts/exynos-pinctrl.h create mode 100644 arch/arm/dts/exynos850-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos850.dtsi
arch/arm/dts/exynos-pinctrl.h new file +79 -0
@@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Samsung Exynos DTS pinctrl constants +* +* Copyright (c) 2016 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* Copyright (c) 2022 Linaro Ltd +* Author: Krzysztof Kozlowski <[email protected]> +*/ + +#ifndef __DTS_ARM64_SAMSUNG_EXYNOS_PINCTRL_H__ +#define __DTS_ARM64_SAMSUNG_EXYNOS_PINCTRL_H__ + +#define EXYNOS_PIN_PULL_NONE 0 +#define EXYNOS_PIN_PULL_DOWN 1 +#define EXYNOS_PIN_PULL_UP 3 + +/* Pin function in power down mode */ +#define EXYNOS_PIN_PDN_OUT0 0 +#define EXYNOS_PIN_PDN_OUT1 1 +#define EXYNOS_PIN_PDN_INPUT 2 +#define EXYNOS_PIN_PDN_PREV 3 + +/* +* Drive strengths for Exynos5410, Exynos542x, Exynos5800, Exynos7885, Exynos850 +* (except GPIO_HSI block), ExynosAutov9 (FSI0, PERIC1) +*/ +#define EXYNOS5420_PIN_DRV_LV1 0 +#define EXYNOS5420_PIN_DRV_LV2 1 +#define EXYNOS5420_PIN_DRV_LV3 2 +#define EXYNOS5420_PIN_DRV_LV4 3 + +/* Drive strengths for Exynos5433 */ +#define EXYNOS5433_PIN_DRV_FAST_SR1 0 +#define EXYNOS5433_PIN_DRV_FAST_SR2 1 +#define EXYNOS5433_PIN_DRV_FAST_SR3 2 +#define EXYNOS5433_PIN_DRV_FAST_SR4 3 +#define EXYNOS5433_PIN_DRV_FAST_SR5 4 +#define EXYNOS5433_PIN_DRV_FAST_SR6 5 +#define EXYNOS5433_PIN_DRV_SLOW_SR1 8 +#define EXYNOS5433_PIN_DRV_SLOW_SR2 9 +#define EXYNOS5433_PIN_DRV_SLOW_SR3 0xa +#define EXYNOS5433_PIN_DRV_SLOW_SR4 0xb +#define EXYNOS5433_PIN_DRV_SLOW_SR5 0xc +#define EXYNOS5433_PIN_DRV_SLOW_SR6 0xf + +/* Drive strengths for Exynos7 (except FSYS1) */ +#define EXYNOS7_PIN_DRV_LV1 0 +#define EXYNOS7_PIN_DRV_LV2 2 +#define EXYNOS7_PIN_DRV_LV3 1 +#define EXYNOS7_PIN_DRV_LV4 3 + +/* Drive strengths for Exynos7 FSYS1 block */ +#define EXYNOS7_FSYS1_PIN_DRV_LV1 0 +#define EXYNOS7_FSYS1_PIN_DRV_LV2 4 +#define EXYNOS7_FSYS1_PIN_DRV_LV3 2 +#define EXYNOS7_FSYS1_PIN_DRV_LV4 6 +#define EXYNOS7_FSYS1_PIN_DRV_LV5 1 +#define EXYNOS7_FSYS1_PIN_DRV_LV6 5 + +/* Drive strengths for Exynos850 GPIO_HSI block */ +#define EXYNOS850_HSI_PIN_DRV_LV1 0/* 1x */ +#define EXYNOS850_HSI_PIN_DRV_LV1_5 1/* 1.5x */ +#define EXYNOS850_HSI_PIN_DRV_LV2 2/* 2x */ +#define EXYNOS850_HSI_PIN_DRV_LV2_5 3/* 2.5x */ +#define EXYNOS850_HSI_PIN_DRV_LV3 4/* 3x */ +#define EXYNOS850_HSI_PIN_DRV_LV4 5/* 4x */ + +#define EXYNOS_PIN_FUNC_INPUT 0 +#define EXYNOS_PIN_FUNC_OUTPUT 1 +#define EXYNOS_PIN_FUNC_2 2 +#define EXYNOS_PIN_FUNC_3 3 +#define EXYNOS_PIN_FUNC_4 4 +#define EXYNOS_PIN_FUNC_5 5 +#define EXYNOS_PIN_FUNC_6 6 +#define EXYNOS_PIN_FUNC_EINT 0xf +#define EXYNOS_PIN_FUNC_F EXYNOS_PIN_FUNC_EINT + +#endif /* __DTS_ARM64_SAMSUNG_EXYNOS_PINCTRL_H__ */
arch/arm/dts/exynos850-pinctrl.dtsi new file +663 -0
663 lines not on this page · raw message
arch/arm/dts/exynos850.dtsi new file +809 -0
809 lines not on this page · raw message
arch/arm/mach-exynos/Kconfig +9 -0
@@ -58,6 +58,15 @@ config ARCH_EXYNOS7 Cortex-A53 CPU (and some in a big.LITTLE configuration). There are multiple SoCs in this family including Exynos7420. +config ARCH_EXYNOS9 + bool "Exynos9 SoC family" + select ARM64 + select BLK + select DM_MMC + help + Samsung Exynos9 SoC family are based on ARMv8 Cortex CPU. There are + multiple SoCs in this family including Exynos850. + endchoice if ARCH_EXYNOS4
arch/arm/mach-exynos/mmu-arm64.c +34 -0
@@ -6,6 +6,7 @@#include <common.h> #include <asm/armv8/mmu.h> +#include <linux/sizes.h> #if IS_ENABLED (CONFIG_EXYNOS7420 )
@@ -95,4 +96,37 @@ static struct mm_region exynos7880_mem_map[] = { };struct mm_region *mem_map = exynos7880_mem_map; + +#elif IS_ENABLED(CONFIG_EXYNOS850) + +static struct mm_region exynos850_mem_map[] = { + { +/* Peripheral block */ + .virt =0x10000000UL , + .phys =0x10000000UL , + .size =SZ_256M , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, { +/* DDR, 32-bit area */ + .virt =0x80000000UL , + .phys =0x80000000UL , + .size =SZ_2G , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_INNER_SHARE + }, { +/* DDR, 64-bit area */ + .virt =0x880000000UL , + .phys =0x880000000UL , + .size =SZ_2G , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_INNER_SHARE + }, { +/* List terminator */ + } +}; + +struct mm_region *mem_map = exynos850_mem_map; +#endif
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 12/13 board: samsung: Add support for E850-96 board
In reply to Sam ProtsenkoAdd support for WinLink E850-96 board [1]. It's based on Exynos850 SoC and follows 96boards specification, so it's compatible with 96boards mezzanine boards [2]. This patch enables next features:
* Serial console
* USI
* PMU (muxing AP UART path)
* Pinctrl
* Clocks
* Timer (ARMv8 architected)
* Reset control
It's quite a minimal enablement. Features like MMC, USB and Ethernet will be enabled later.
The rationale for config values is as follows:
* TEXT_BASE = 0xf8800000
That's where BL2 loads the U-Boot payload, so TEXT_BASE must be exactly this value. Overall the memory map is designed in a way to keep the bootloader in the upper 128 MiB area of RAM, which is 0xf8000000..0xffffffff. That includes bootloader's code, stack, data, heap, MMU tables, etc. All the memory below that 128 MiB chunk can be used for storing boot images (0x80000000..0xf8000000).
* CUSTOM_SYS_INIT_SP_ADDR = 0xf8c00000
Just 4 MiB above the TEXT_BASE address, to leave enough space for U-Boot code and stack itself (grows downwards).
* SYS_LOAD_ADDR = 0x80000000
The beginning of RAM. That's where Linux kernel image must be loaded.
* SYS_MALLOC_LEN = 0x81f000
8 MiB for malloc() + ENV_SIZE (128 KiB)
* SYS_MALLOC_F_LEN = 0x4000
Increase malloc() pool size available before relocation from 8 KiB (default) to 16 KiB. Otherwise "alloc space exhausted" message appears in U-Boot log during board_init_f() stage. There are next reasons for doing so:
1. Having "bootph-all" flags in some dts nodes leads to binding those during pre-relocation stage, and binding (DM) uses dynamic memory allocation
2. clk-exynos850 driver uses CCF clocks, which in turn use dynamic memory allocation
Device tree file was imported from Linux kernel. All nodes and boot phase flags added in exynos850-e850-96-u-boot.dtsi are only needed to enable serial console:
* oscclk -> cmu_top -> cmu_peri: generate UART/USI clocks
* pinctrl_alive and uart1_pins: needed to mux UART pins
* pmu_system_controller: configures AP UART path to uart1_pins
* usi_uart: configures USI block to operate as a UART protocol
* serial_0: enables serial console (UART)
[1] https://www.96boards.org/product/e850-96b/
[2] https://www.96boards.org/products/mezzanine/
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/exynos850-e850-96-u-boot.dtsi | 37 + arch/arm/dts/exynos850-e850-96.dts | 273 ++++ arch/arm/mach-exynos/Kconfig | 19 +- board/samsung/e850-96/Kconfig | 16 + board/samsung/e850-96/MAINTAINERS | 9 + board/samsung/e850-96/Makefile | 6 + board/samsung/e850-96/e850-96.c | 22 + configs/e850-96_defconfig | 21 + doc/board/samsung/e850-96.rst | 87 ++ .../img/exynos850-boot-architecture.svg | 1283 +++++++++++++++++ doc/board/samsung/index.rst | 1 + include/configs/e850-96.h | 12 + 13 files changed, 1786 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/exynos850-e850-96-u-boot.dtsi create mode 100644 arch/arm/dts/exynos850-e850-96.dts create mode 100644 board/samsung/e850-96/Kconfig create mode 100644 board/samsung/e850-96/MAINTAINERS create mode 100644 board/samsung/e850-96/Makefile create mode 100644 board/samsung/e850-96/e850-96.c create mode 100644 configs/e850-96_defconfig create mode 100644 doc/board/samsung/e850-96.rst create mode 100644 doc/board/samsung/img/exynos850-boot-architecture.svg create mode 100644 include/configs/e850-96.h
arch/arm/dts/Makefile +1 -0
@@ -31,6 +31,7 @@ dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb dtb-$(CONFIG_TARGET_A5Y17LTE) += exynos78x0-axy17lte.dtb dtb-$(CONFIG_TARGET_A3Y17LTE) += exynos78x0-axy17lte.dtb dtb-$(CONFIG_TARGET_A7Y17LTE) += exynos78x0-axy17lte.dtb +dtb-$(CONFIG_TARGET_E850_96) += exynos850-e850-96.dtb dtb-$(CONFIG_ARCH_APPLE) += \ t8103-j274.dtb \
arch/arm/dts/exynos850-e850-96-u-boot.dtsi new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 Linaro Ltd. + */ + +&cmu_top { + bootph-all; +}; + +&cmu_peri { + bootph-all; +}; + +&oscclk { + bootph-all; +}; + +&pinctrl_alive { + bootph-all; +}; + +&pmu_system_controller { + bootph-all; + samsung,uart-debug-1; +}; + +&serial_0 { + bootph-all; +}; + +&uart1_pins { + bootph-all; +}; + +&usi_uart { + bootph-all; +};
arch/arm/dts/exynos850-e850-96.dts new file +273 -0
273 lines not on this page · raw message
arch/arm/mach-exynos/Kconfig +18 -1
@@ -2,7 +2,7 @@ if ARCH_EXYNOS config BOARD_COMMON def_bool y - depends on !TARGET_SMDKV310 && !TARGET_ARNDALE + depends on !TARGET_SMDKV310 && !TARGET_ARNDALE && !TARGET_E850_96 config SPI_BOOTING bool
@@ -237,6 +237,22 @@ config TARGET_A3Y17LTE endchoice endif +if ARCH_EXYNOS9 + +choice + prompt "EXYNOS9 board select" + +config TARGET_E850_96 + bool "WinLink E850-96 board" + select ARM64 + select CLK_EXYNOS + select OF_CONTROL + select PINCTRL + select PINCTRL_EXYNOS850 + +endchoice +endif + config SYS_SOC default "exynos"
@@ -261,5 +277,6 @@ source "board/samsung/smdk5250/Kconfig" source "board/samsung/smdk5420/Kconfig" source "board/samsung/espresso7420/Kconfig" source "board/samsung/axy17lte/Kconfig" +source "board/samsung/e850-96/Kconfig" endif
board/samsung/e850-96/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +if TARGET_E850_96 + +config EXYNOS850 + bool "Exynos850 SoC support" + default y + +config SYS_BOARD + default "e850-96" + +config SYS_VENDOR + default "samsung" + +config SYS_CONFIG_NAME + default "e850-96" + +endif
board/samsung/e850-96/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +WINLINK E850-96 BOARD +M: Sam Protsenko <[email protected]> +S: Maintained +F: arch/arm/dts/exynos850-e850-96-u-boot.dtsi +F: arch/arm/dts/exynos850-e850-96.dts +F: board/samsung/e850-96/ +F: configs/e850-96_defconfig +F: doc/board/samsung/e850-96.rst +F: include/configs/e850-96.h
board/samsung/e850-96/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2020, Linaro Limited +# Sam Protsenko <[email protected]> + +obj-y := e850-96.o
board/samsung/e850-96/e850-96.c new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020, Linaro Limited +* Sam Protsenko <[email protected]> +*/ + +#include <init.h> + +int dram_init (void ) +{ +return fdtdec_setup_mem_size_base (); +} + +int dram_init_banksize (void ) +{ +return fdtdec_setup_memory_banksize (); +} + +int board_init (void ) +{ +return 0 ; +}
configs/e850-96_defconfig new file +21 -0
@@ -0,0 +1,21 @@ +CONFIG_ARM=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_EXYNOS=y +CONFIG_TEXT_BASE=0xf8800000 +CONFIG_SYS_MALLOC_LEN=0x81f000 +CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_ARCH_EXYNOS9=y +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xf8c00000 +CONFIG_DEFAULT_DEVICE_TREE="exynos850-e850-96" +CONFIG_SYS_LOAD_ADDR=0x80000000 +# CONFIG_AUTOBOOT is not set +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_NET is not set +CONFIG_CLK_EXYNOS850=y +# CONFIG_MMC is not set +CONFIG_SOC_SAMSUNG=y +CONFIG_EXYNOS_PMU=y +CONFIG_EXYNOS_USI=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_SYSCON=y
doc/board/samsung/e850-96.rst new file +87 -0
87 lines not on this page · raw message
doc/board/samsung/img/exynos850-boot-architecture.svg new file +1283 -0
1,283 lines not on this page · raw message
doc/board/samsung/index.rst +1 -0
@@ -7,3 +7,4 @@ Samsung :maxdepth: 2 axy17lte + e850-96
include/configs/e850-96.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2020, Linaro Limited +* Sam Protsenko <[email protected]> +* +* Configuration for E850-96 board. +*/ + +#ifndef __E850_96_H +#define __E850_96_H + +#endif /* __E850_96_H */
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH 13/13 MAINTAINERS: Add new Samsung subsystems
In reply to Sam ProtsenkoAdd next Samsung subsystems with Sam Protsenko as a maintainer:
- Samsung CCF Clock Framework
- Exynos850 SoC Support
- Samsung SoC Drivers
--- MAINTAINERS | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
MAINTAINERS +25 -0
@@ -560,6 +560,31 @@ F: arch/arm/mach-exynos/ F: arch/arm/mach-s5pc1xx/ F: arch/arm/cpu/armv7/s5p-common/ +ARM SAMSUNG CLOCK +M: Sam Protsenko <[email protected]> +S: Maintained +F: drivers/clk/exynos/clk-pll.c +F: drivers/clk/exynos/clk-pll.h +F: drivers/clk/exynos/clk.c +F: drivers/clk/exynos/clk.h + +ARM SAMSUNG EXYNOS850 SOC +M: Sam Protsenko <[email protected]> +S: Maintained +F: arch/arm/dts/exynos850-pinctrl.dtsi +F: arch/arm/dts/exynos850.dtsi +F: doc/device-tree-bindings/clock/samsung,exynos850-clock.yaml +F: drivers/clk/exynos/clk-exynos850.c +F: drivers/pinctrl/exynos/pinctrl-exynos850.c +F: include/dt-bindings/clock/exynos850.h + +ARM SAMSUNG SOC DRIVERS +M: Sam Protsenko <[email protected]> +S: Maintained +F: doc/device-tree-bindings/soc/samsung/* +F: drivers/soc/samsung/* +F: include/dt-bindings/soc/samsung,*.h + ARM SANCLOUD M: Paul Barker <[email protected]> R: Marc Murphy <[email protected]>
Signature · 1 line
2.39.2
Sam Protsenko
maintainerQuoted 134 lines · Sam Protsenko
NOTE: This patch series depends on "pinctrl: exynos: Prepare for other SoCs support" series [1]. It should be applied first.
Add Exynos850 SoC and WinLink's E850-96 board support. A short overview of series additions and modifications:
* USI driver: configures UART block
* PMU driver: connects AP UART lines to uart1 pins)
* Exynos850 clock driver: generates UART clocks
* Exynos850 pinctrl driver: mux UART pins
*serial_s5p: UART driver
* Exynos850 SoC: dtsi files and MMU maps
* E850-96 board: dts files, defconfig, board file and docMost of the code was borrowed from mainline Linux kernel (where this board is already enabled) and adapted for U-Boot. Preliminary preparation for this series includes next patches / series (already merged):
* commit
585a2aaac2ac("arm: exynos: Include missing CPU header insoc.c") * commit c9ab9f30c8e4 ("arm: exynos: Include missing CPU header in gpio.h") * commit 11bd2787deff ("watchdog: s5p_wdt: Include missing CPU header") * commit 08cfa971a717 ("exynos: Avoid duplicate reset_cpu with SYSRESET enabled") * commit f655090901dc ("clk: exynos: Add header guard for clk-pll.h") * commit 2227f4c0afed ("serial: s5p: Fix clk_get_by_index() error code check")* commit
a0615ffc99a5("serial: s5p: Removecommon.hinclusion")
* commit5ad21de6bae0("serial: s5p: Use livetree API to get "id" property")
* commite79f630dbf67("serial: s5p: Use named constants for register values")
* commita627f2802a71("serial: s5p: Improve coding style")
* commit33e7ca5a9b6a("serial: s5p: Usedev_read_addr_ptr()to get base address")
* commit6219b47c4d91("board: samsung: FixSYS_CONFIG_NAMEconfigs in axy17lteKconfig")
* commit470682ace1e0("configs: Remove unneededSYS_CONFIG_NAMEfrom a*y17lte defconfigs")and series [1] (dependency) is still pending.
For more detailed description please see the board documentation (added in PATCH #12) and corresponding commit messages.
[1] https://lists.denx.de/pipermail/u-boot/2023-November/539033.html
Sam Protsenko (13):
dt-bindings: soc: samsung: Add Exynos USI
dt-bindings: soc: samsung: Add Exynos PMU
dt-bindings: clock: Add Exynos850 clock controller
soc: samsung: Add Exynos USI driver
soc: samsung: Add Exynos PMU driver
clk: exynos: Move pll code into clk-exynos7420
clk: exynos: Add Samsung clock framework
clk: exynos: Add Exynos850 clock driver
pinctrl: exynos: Add pinctrl support for Exynos850
serial: s5p: Add Exynos850 compatible
arm: exynos: Add Exynos850 SoC support
board: samsung: Add support for E850-96 board
MAINTAINERS: Add new Samsung subsystemsMAINTAINERS | 25 + arch/arm/dts/Makefile | 1 + arch/arm/dts/exynos-pinctrl.h | 79 + arch/arm/dts/exynos850-e850-96-u-boot.dtsi | 37 + arch/arm/dts/exynos850-e850-96.dts | 273 ++++ arch/arm/dts/exynos850-pinctrl.dtsi | 663 +++++++++ arch/arm/dts/exynos850.dtsi | 809 +++++++++++ arch/arm/mach-exynos/Kconfig | 28 +- arch/arm/mach-exynos/mmu-arm64.c | 34 + board/samsung/e850-96/Kconfig | 16 + board/samsung/e850-96/MAINTAINERS | 9 + board/samsung/e850-96/Makefile | 6 + board/samsung/e850-96/e850-96.c | 22 + configs/e850-96_defconfig | 21 + doc/board/samsung/e850-96.rst | 87 ++ .../img/exynos850-boot-architecture.svg | 1283 +++++++++++++++++ doc/board/samsung/index.rst | 1 + .../clock/samsung,exynos850-clock.yaml | 307 ++++ .../soc/samsung/exynos-pmu.yaml | 85 ++ .../soc/samsung/exynos-usi.yaml | 162 +++ drivers/clk/exynos/Kconfig | 7 + drivers/clk/exynos/Makefile | 11 +- drivers/clk/exynos/clk-exynos7420.c | 25 +- drivers/clk/exynos/clk-exynos850.c | 189 +++ drivers/clk/exynos/clk-pll.c | 167 ++- drivers/clk/exynos/clk-pll.h | 16 +- drivers/clk/exynos/clk.c | 121 ++ drivers/clk/exynos/clk.h | 228 +++ drivers/pinctrl/exynos/Kconfig | 8 + drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 ++ drivers/serial/serial_s5p.c | 1 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 33 + drivers/soc/samsung/Makefile | 4 + drivers/soc/samsung/exynos-pmu.c | 102 ++ drivers/soc/samsung/exynos-usi.c | 218 +++ include/configs/e850-96.h | 12 + include/dt-bindings/clock/exynos850.h | 337 +++++ include/dt-bindings/soc/samsung,exynos-usi.h | 17 + 41 files changed, 5548 insertions(+), 24 deletions(-) create mode 100644 arch/arm/dts/exynos-pinctrl.h create mode 100644 arch/arm/dts/exynos850-e850-96-u-boot.dtsi create mode 100644 arch/arm/dts/exynos850-e850-96.dts create mode 100644 arch/arm/dts/exynos850-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos850.dtsi create mode 100644 board/samsung/e850-96/Kconfig create mode 100644 board/samsung/e850-96/MAINTAINERS create mode 100644 board/samsung/e850-96/Makefile create mode 100644 board/samsung/e850-96/e850-96.c create mode 100644 configs/e850-96_defconfig create mode 100644 doc/board/samsung/e850-96.rst create mode 100644 doc/board/samsung/img/exynos850-boot-architecture.svg create mode 100644 doc/device-tree-bindings/clock/samsung,exynos850-clock.yaml create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-pmu.yaml create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-usi.yaml create mode 100644 drivers/clk/exynos/clk-exynos850.c create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.h create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.c create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-pmu.c create mode 100644 drivers/soc/samsung/exynos-usi.c create mode 100644 include/configs/e850-96.h create mode 100644 include/dt-bindings/clock/exynos850.h create mode 100644 include/dt-bindings/soc/samsung,exynos-usi.h
Quoted 1 line
--
Hi Tom, Minkyu,
Would really appreciate a review for this series. It's not only adding a new board, but also a bunch of stuff that I think can be useful for other modern Exynos platforms (CCF Samsung clock framework, USI driver, etc).
Thanks!
Quoted 2 lines
2.39.2
Hi,
2023년 12월 19일 (화) 07:07, Sam Protsenko <[email protected]>님이 작성:
Quoted 139 lines
Quoted 112 lines · Sam Protsenko
NOTE: This patch series depends on "pinctrl: exynos: Prepare for other SoCs support" series [1]. It should be applied first.
Add Exynos850 SoC and WinLink's E850-96 board support. A short overview of series additions and modifications:
* USI driver: configures UART block
* PMU driver: connects AP UART lines to uart1 pins)
* Exynos850 clock driver: generates UART clocks
* Exynos850 pinctrl driver: mux UART pins
*serial_s5p: UART driver
* Exynos850 SoC: dtsi files and MMU maps
* E850-96 board: dts files, defconfig, board file and docMost of the code was borrowed from mainline Linux kernel (where this board is already enabled) and adapted for U-Boot. Preliminary preparation for this series includes next patches / series (already merged):
* commit
585a2aaac2ac("arm: exynos: Include missing CPU header insoc.c") * commit c9ab9f30c8e4 ("arm: exynos: Include missing CPU header in gpio.h") * commit 11bd2787deff ("watchdog: s5p_wdt: Include missing CPU header") * commit 08cfa971a717 ("exynos: Avoid duplicate reset_cpu with SYSRESET enabled") * commit f655090901dc ("clk: exynos: Add header guard for clk-pll.h") * commit 2227f4c0afed ("serial: s5p: Fix clk_get_by_index() error code check")* commit
a0615ffc99a5("serial: s5p: Removecommon.hinclusion")
* commit5ad21de6bae0("serial: s5p: Use livetree API to get "id" property")
* commite79f630dbf67("serial: s5p: Use named constants for register values")
* commita627f2802a71("serial: s5p: Improve coding style")
* commit33e7ca5a9b6a("serial: s5p: Usedev_read_addr_ptr()to get base address")
* commit6219b47c4d91("board: samsung: FixSYS_CONFIG_NAMEconfigs in axy17lteKconfig")
* commit470682ace1e0("configs: Remove unneededSYS_CONFIG_NAMEfrom a*y17lte defconfigs")and series [1] (dependency) is still pending.
For more detailed description please see the board documentation (added in PATCH #12) and corresponding commit messages.
[1] https://lists.denx.de/pipermail/u-boot/2023-November/539033.html
Sam Protsenko (13):
dt-bindings: soc: samsung: Add Exynos USI
dt-bindings: soc: samsung: Add Exynos PMU
dt-bindings: clock: Add Exynos850 clock controller
soc: samsung: Add Exynos USI driver
soc: samsung: Add Exynos PMU driver
clk: exynos: Move pll code into clk-exynos7420
clk: exynos: Add Samsung clock framework
clk: exynos: Add Exynos850 clock driver
pinctrl: exynos: Add pinctrl support for Exynos850
serial: s5p: Add Exynos850 compatible
arm: exynos: Add Exynos850 SoC support
board: samsung: Add support for E850-96 board
MAINTAINERS: Add new Samsung subsystemsMAINTAINERS | 25 + arch/arm/dts/Makefile | 1 + arch/arm/dts/exynos-pinctrl.h | 79 + arch/arm/dts/exynos850-e850-96-u-boot.dtsi | 37 + arch/arm/dts/exynos850-e850-96.dts | 273 ++++ arch/arm/dts/exynos850-pinctrl.dtsi | 663 +++++++++ arch/arm/dts/exynos850.dtsi | 809 +++++++++++ arch/arm/mach-exynos/Kconfig | 28 +- arch/arm/mach-exynos/mmu-arm64.c | 34 + board/samsung/e850-96/Kconfig | 16 + board/samsung/e850-96/MAINTAINERS | 9 + board/samsung/e850-96/Makefile | 6 + board/samsung/e850-96/e850-96.c | 22 + configs/e850-96_defconfig | 21 + doc/board/samsung/e850-96.rst | 87 ++ .../img/exynos850-boot-architecture.svg | 1283 +++++++++++++++++ doc/board/samsung/index.rst | 1 + .../clock/samsung,exynos850-clock.yaml | 307 ++++ .../soc/samsung/exynos-pmu.yaml | 85 ++ .../soc/samsung/exynos-usi.yaml | 162 +++ drivers/clk/exynos/Kconfig | 7 + drivers/clk/exynos/Makefile | 11 +- drivers/clk/exynos/clk-exynos7420.c | 25 +- drivers/clk/exynos/clk-exynos850.c | 189 +++ drivers/clk/exynos/clk-pll.c | 167 ++- drivers/clk/exynos/clk-pll.h | 16 +- drivers/clk/exynos/clk.c | 121 ++ drivers/clk/exynos/clk.h | 228 +++ drivers/pinctrl/exynos/Kconfig | 8 + drivers/pinctrl/exynos/Makefile | 1 + drivers/pinctrl/exynos/pinctrl-exynos850.c | 125 ++ drivers/serial/serial_s5p.c | 1 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 33 + drivers/soc/samsung/Makefile | 4 + drivers/soc/samsung/exynos-pmu.c | 102 ++ drivers/soc/samsung/exynos-usi.c | 218 +++ include/configs/e850-96.h | 12 + include/dt-bindings/clock/exynos850.h | 337 +++++ include/dt-bindings/soc/samsung,exynos-usi.h | 17 + 41 files changed, 5548 insertions(+), 24 deletions(-) create mode 100644 arch/arm/dts/exynos-pinctrl.h create mode 100644 arch/arm/dts/exynos850-e850-96-u-boot.dtsi create mode 100644 arch/arm/dts/exynos850-e850-96.dts create mode 100644 arch/arm/dts/exynos850-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos850.dtsiQuoted 8 lines
create mode 100644 board/samsung/e850-96/Kconfig create mode 100644 board/samsung/e850-96/MAINTAINERS create mode 100644 board/samsung/e850-96/Makefile create mode 100644 board/samsung/e850-96/e850-96.c create mode 100644 configs/e850-96_defconfig create mode 100644 doc/board/samsung/e850-96.rst create mode 100644 doc/board/samsung/img/exynos850-boot-architecture.svg create mode 100644
doc/device-tree-bindings/clock/samsung,exynos850-clock.yamlQuoted 14 lines
create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-pmu.yaml create mode 100644 doc/device-tree-bindings/soc/samsung/exynos-usi.yaml create mode 100644 drivers/clk/exynos/clk-exynos850.c create mode 100644 drivers/clk/exynos/clk.c create mode 100644 drivers/clk/exynos/clk.h create mode 100644 drivers/pinctrl/exynos/pinctrl-exynos850.c create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-pmu.c create mode 100644 drivers/soc/samsung/exynos-usi.c create mode 100644 include/configs/e850-96.h create mode 100644 include/dt-bindings/clock/exynos850.h create mode 100644 include/dt-bindings/soc/samsung,exynos-usi.hQuoted 1 line
--
Quoted 8 lines
Hi Tom, Minkyu,
Would really appreciate a review for this series. It's not only adding a new board, but also a bunch of stuff that I think can be useful for other modern Exynos platforms (CCF Samsung clock framework, USI driver, etc).
Thanks!
I'm in middle of holiday recently, so it is difficult to review actually. I'll check soon.
Merry christmas.
Thanks.
Minkyu Kang.