sh: Common PCI Framework driver support.
Subsystems (12)
Yoshinori Sato
maintainerPATCH v7 9/36 sh: Common PCI Framework driver support.
In reply to a message not in the archiveAdd New OF based PCI Host driver.
This driver conflicts some point in legacy PCI driver. To resolve the conflict, I made some changes to the legacy driver.
--- arch/sh/include/asm/io.h | 6 ++++++ arch/sh/include/asm/pci.h | 4 ++++ arch/sh/kernel/iomap.c | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+)
arch/sh/include/asm/io.h +6 -0
@@ -20,6 +20,7 @@#include <asm/page.h> #include <linux/pgtable.h> #include <asm-generic/iomap.h> +#include <linux/ioport.h> #define __IO_PREFIX generic#include <asm/io_generic.h>
@@ -310,4 +311,9 @@ unsigned long long poke_real_address_q(unsigned long long addr,int valid_phys_addr_range (phys_addr_t addr,size_t size);int valid_mmap_phys_addr_range (unsigned long pfn,size_t size); +#if defined(CONFIG_PCI ) && !defined(CONFIG_GENERIC_IOMAP ) +#define pci_remap_iospace pci_remap_iospace +int pci_remap_iospace (const struct resource *res,phys_addr_t phys_addr); +#endif +#endif /* __ASM_SH_IO_H */
arch/sh/include/asm/pci.h +4 -0
@@ -2,6 +2,7 @@#ifndef __ASM_SH_PCI_H#define __ASM_SH_PCI_H +#ifndef CONFIG_SH_DEVICE_TREE /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */
@@ -88,4 +89,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)return hose->need_domain_info; } +#else /* CONFIG_SH_DEVICE_TREE */ +#include <asm-generic/pci.h> +#endif #endif /* __ASM_SH_PCI_H */
arch/sh/kernel/iomap.c +18 -0
@@ -160,3 +160,21 @@ void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)mmio_outsl (addr, src, count); }EXPORT_SYMBOL (iowrite32_rep); + +#if defined(pci_remap_iospace) +int pci_remap_iospace (const struct resource *res,phys_addr_t phys_addr) +{ +unsigned long vaddr = res->start; + +if (!(res->flags &IORESOURCE_IO )) +return -EINVAL ; + +if (res->end >IO_SPACE_LIMIT ) +return -EINVAL ; + +__set_io_port_base (phys_addr); +return vmap_page_range (vaddr, vaddr +resource_size (res), phys_addr, +pgprot_device (PAGE_KERNEL )); +} +EXPORT_SYMBOL (pci_remap_iospace); +#endif
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 10/36 pci: pci-sh7751: Add SH7751 PCI driver
In reply to a message not in the archiveRenesas SH7751 CPU Internal PCI Controller driver.
--- drivers/pci/controller/Kconfig | 9 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pci-sh7751.c | 342 ++++++++++++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 drivers/pci/controller/pci-sh7751.c
drivers/pci/controller/Kconfig +9 -0
@@ -353,6 +353,15 @@ config PCIE_XILINX_CPM Say 'Y' here if you want kernel support for the Xilinx Versal CPM host bridge. +config PCI_SH7751 + bool "Renesas SH7751 PCI controller" + depends on OF + depends on CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST + select PCI_HOST_COMMON + help + Say 'Y' here if you want kernel to support the Renesas SH7751 PCI + Host Bridge driver. + source "drivers/pci/controller/cadence/Kconfig" source "drivers/pci/controller/dwc/Kconfig" source "drivers/pci/controller/mobiveil/Kconfig"
drivers/pci/controller/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o obj-$(CONFIG_PCIE_APPLE) += pcie-apple.o obj-$(CONFIG_PCIE_MT7621) += pcie-mt7621.o +obj-$(CONFIG_PCI_SH7751) += pci-sh7751.o # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW obj-y += dwc/
drivers/pci/controller/pci-sh7751.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 11/36 dt-bindings: pci: pci-sh7751: Add SH7751 PCI
In reply to a message not in the archiveRenesas SH7751 PCI Controller json-schema.
--- .../bindings/pci/renesas,sh7751-pci.yaml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +89 -0
@@ -0,0 +1,89 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/renesas,sh7751-pci.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7751 PCI Host controller + +maintainers: + - Yoshinori Sato <[email protected]> + +allOf: + - $ref: /schemas/pci/pci-bus.yaml# + +properties: + compatible: + const: renesas,sh7751-pci + + reg: + minItems: 2 + maxItems: 2 + + reg-names: + items: + - const: PCI Controller + - const: Bus State Controller + + "#interrupt-cells": + const: 1 + + "#address-cells": + const: 3 + + "#size-cells": + const: 2 + + ranges: true + + dma-ranges: true + + interrupt-controller: true + + renesas,bus-arbit-round-robin: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Set DMA bus arbitration to round robin. + +required: + - compatible + - reg + - "#interrupt-cells" + - "#address-cells" + - "#size-cells" + - ranges + - interrupt-map + - interrupt-map-mask + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + pci@fe200000 { + compatible = "renesas,sh7751-pci"; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-controller; + device_type = "pci"; + bus-range = <0 0>; + ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>, + <0x01000000 0 0x00000000 0xfe240000 0 0x00040000>; + dma-ranges = <0x02000000 0 0xc000000 0x0c000000 0 0x04000000>; + reg = <0xfe200000 0x0400>, + <0xff800000 0x0100>; + interrupt-map = <0x0000 0 0 1 &julianintc 5 IRQ_TYPE_LEVEL_LOW>, + <0x0000 0 0 2 &julianintc 6 IRQ_TYPE_LEVEL_LOW>, + <0x0000 0 0 3 &julianintc 7 IRQ_TYPE_LEVEL_LOW>, + <0x0000 0 0 4 &julianintc 8 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 1 &julianintc 6 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 2 &julianintc 7 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 3 &julianintc 8 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 4 &julianintc 5 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 1 &julianintc 7 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 2 &julianintc 8 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 3 &julianintc 5 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 4 &julianintc 6 IRQ_TYPE_LEVEL_LOW>; + interrupt-map-mask = <0x1800 0 0 7>; + };
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 12/36 dt-bindings: clock: sh7750-cpg: Add renesas,sh7750-cpg header.
In reply to a message not in the archiveSH7750 CPG Clock output define.
--- .../bindings/clock/renesas,sh7750-cpg.yaml | 105 ++++++++++++++++++ include/dt-bindings/clock/sh7750-cpg.h | 26 +++++ 2 files changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml create mode 100644 include/dt-bindings/clock/sh7750-cpg.h
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +105 -0
@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/renesas,sh7750-cpg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7750/7751 Clock Pulse Generator (CPG) + +maintainers: + - Yoshinori Sato <[email protected]> + +description: + The Clock Pulse Generator (CPG) generates core clocks for the SoC. It + includes PLLs, and variable ratio dividers. + + The CPG may also provide a Clock Domain for SoC devices, in combination with + the CPG Module Stop (MSTP) Clocks. + +properties: + compatible: + enum: + - renesas,sh7750-cpg # SH7750 + - renesas,sh7750s-cpg # SH775S + - renesas,sh7750r-cpg # SH7750R + - renesas,sh7751-cpg # SH7751 + - renesas,sh7751r-cpg # SH7751R + + reg: true + + reg-names: true + + clocks: + maxItems: 1 + + clock-names: + const: extal + + '#clock-cells': + const: 1 + + renesas,mode: + description: Board-specific settings of the MD[0-2] pins on SoC + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 6 + + '#power-domain-cells': + const: 0 + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - '#clock-cells' + +allOf: + - if: + properties: + compatible: + contains: + enum: + - renesas,sh7750-cpg + - renesas,sh7750s-cpg + then: + properties: + reg: + maxItems: 1 + reg-names: + items: + - const: FRQCR + + - if: + properties: + compatible: + contains: + enum: + - renesas,sh7750r-cpg + - renesas,sh7751-cpg + - renesas,sh7751r-cpg + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: FRQCR + - const: CLKSTP00 + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/sh7750-cpg.h> + cpg: clock-controller@ffc00000 { + #clock-cells = <1>; + #power-domain-cells = <0>; + compatible = "renesas,sh7751r-cpg"; + clocks = <&extal>; + clock-names = "extal"; + reg = <0xffc00000 20>, <0xfe0a0000 16>; + reg-names = "FRQCR", "CLKSTP00"; + renesas,mode = <0>; + };
include/dt-bindings/clock/sh7750-cpg.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +* +* Copyright 2023 Yoshinori Sato +*/ + +#ifndef __DT_BINDINGS_CLOCK_SH7750_H__ +#define __DT_BINDINGS_CLOCK_SH7750_H__ + +#define SH7750_CPG_PLLOUT 0 + +#define SH7750_CPG_PCK 1 +#define SH7750_CPG_BCK 2 +#define SH7750_CPG_ICK 3 + +#define SH7750_MSTP_SCI 4 +#define SH7750_MSTP_RTC 5 +#define SH7750_MSTP_TMU012 6 +#define SH7750_MSTP_SCIF 7 +#define SH7750_MSTP_DMAC 8 +#define SH7750_MSTP_UBC 9 +#define SH7750_MSTP_SQ 10 +#define SH7750_CSTP_INTC 11 +#define SH7750_CSTP_TMU34 12 +#define SH7750_CSTP_PCIC 13 + +#endif
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 13/36 clk: Compatible with narrow registers
In reply to a message not in the archivedivider and gate only support 32-bit registers.
Older hardware uses narrower registers, so I want to be able to handle 8-bit and 16-bit wide registers.
Seven clk_divider flags are used, and if I add flags for 8bit access and 16bit access, 8bit will not be enough, so I expanded it to u16.
--- drivers/clk/clk-divider.c | 56 +++++++++++++++++++++----------- drivers/clk/clk-gate.c | 62 ++++++++++++++++++++++++++++-------- include/linux/clk-provider.h | 22 ++++++++++--- 3 files changed, 103 insertions(+), 37 deletions(-)
drivers/clk/clk-divider.c +37 -19
@@ -26,20 +26,38 @@* parent - fixed parent. No clk_set_parent support */ -static inline u32 clk_div_readl (struct clk_divider *divider) -{ -if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) -return ioread32be (divider->reg); - -return readl (divider->reg); +static inline u32 clk_div_read (struct clk_divider *divider) +{ +if (divider->flags &CLK_DIVIDER_REG_8BIT ) +return readb (divider->reg); +else if (divider->flags &CLK_DIVIDER_REG_16BIT ) { +if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) +return ioread16be (divider->reg); +else +return readw (divider->reg); + }else { +if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) +return ioread32be (divider->reg); +else +return readl (divider->reg); + } } -static inline void clk_div_writel (struct clk_divider *divider,u32 val) +static inline void clk_div_write (struct clk_divider *divider,u32 val) { -if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) -iowrite32be (val, divider->reg); -else -writel (val, divider->reg); +if (divider->flags &CLK_DIVIDER_REG_8BIT ) +writeb (val, divider->reg); +else if (divider->flags &CLK_DIVIDER_REG_16BIT ) { +if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) +iowrite16be (val, divider->reg); +else +writew (val, divider->reg); + }else { +if (divider->flags &CLK_DIVIDER_BIG_ENDIAN ) +iowrite32be (val, divider->reg); +else +writel (val, divider->reg); + } } static unsigned int _get_table_maxdiv(const struct clk_div_table *table,
@@ -152,7 +170,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,struct clk_divider *divider =to_clk_divider (hw);unsigned int val; - val =clk_div_readl (divider) >> divider->shift; + val =clk_div_read (divider) >> divider->shift; val &=clk_div_mask (divider->width); return divider_recalc_rate(hw, parent_rate, val, divider->table,
@@ -434,7 +452,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,if (divider->flags &CLK_DIVIDER_READ_ONLY ) {u32 val; - val =clk_div_readl (divider) >> divider->shift; + val =clk_div_read (divider) >> divider->shift; val &=clk_div_mask (divider->width); return divider_ro_round_rate(hw, rate, prate, divider->table,
@@ -455,7 +473,7 @@ static int clk_divider_determine_rate(struct clk_hw *hw,if (divider->flags &CLK_DIVIDER_READ_ONLY ) {u32 val; - val =clk_div_readl (divider) >> divider->shift; + val =clk_div_read (divider) >> divider->shift; val &=clk_div_mask (divider->width); return divider_ro_determine_rate(hw, req, divider->table,
@@ -505,11 +523,11 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,if (divider->flags &CLK_DIVIDER_HIWORD_MASK ) { val =clk_div_mask (divider->width) << (divider->shift +16 ); }else { - val =clk_div_readl (divider); + val =clk_div_read (divider); val &= ~(clk_div_mask (divider->width) << divider->shift); } val |= (u32 )value << divider->shift; -clk_div_writel (divider, val); +clk_div_write (divider, val);if (divider->lock)spin_unlock_irqrestore (divider->lock, flags);
@@ -538,7 +556,7 @@ struct clk_hw *__clk_hw_register_divider(struct device *dev, struct device_node *np, const char *name, const char *parent_name, const struct clk_hw *parent_hw, const struct clk_parent_data *parent_data, unsigned long flags, - void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, + void __iomem *reg, u8 shift, u8 width, u32 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock) { struct clk_divider *div;
@@ -610,7 +628,7 @@ EXPORT_SYMBOL_GPL(__clk_hw_register_divider);struct clk *clk_register_divider_table (struct device *dev,const char *name,const char *parent_name,unsigned long flags,void __iomem *reg,u8 shift,u8 width, -u8 clk_divider_flags,const struct clk_div_table *table, +u32 clk_divider_flags,const struct clk_div_table *table,spinlock_t *lock) {struct clk_hw *hw;
@@ -664,7 +682,7 @@ struct clk_hw *__devm_clk_hw_register_divider(struct device *dev, struct device_node *np, const char *name, const char *parent_name, const struct clk_hw *parent_hw, const struct clk_parent_data *parent_data, unsigned long flags, - void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, + void __iomem *reg, u8 shift, u8 width, u32 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock) { struct clk_hw **ptr, *hw;
drivers/clk/clk-gate.c +49 -13
102 lines not on this page · raw message
include/linux/clk-provider.h +17 -5
@@ -508,12 +508,16 @@ void of_fixed_clk_setup(struct device_node *np);* CLK_GATE_BIG_ENDIAN - by default little endian register accesses are used for * the gate register. Setting this flag makes the register accesses big * endian. +* CLK_GATE_REG_8BIT - by default 32bit register accesses are used for +* the gate register. Setting this flag makes the register accesses 8bit. +* CLK_GATE_REG_16BIT - by default 32bit register accesses are used for +* the gate register. Setting this flag makes the register accesses 16bit. */ struct clk_gate {struct clk_hw hw;void __iomem *reg;u8 bit_idx; -u8 flags; +u32 flags;spinlock_t *lock; };
@@ -522,6 +526,8 @@ struct clk_gate {#define CLK_GATE_SET_TO_DISABLE BIT(0)#define CLK_GATE_HIWORD_MASK BIT(1)#define CLK_GATE_BIG_ENDIAN BIT(2) +#define CLK_GATE_REG_8BIT BIT(3) +#define CLK_GATE_REG_16BIT BIT(4)extern const struct clk_ops clk_gate_ops; struct clk_hw *__clk_hw_register_gate(struct device *dev,
@@ -675,13 +681,17 @@ struct clk_div_table {* CLK_DIVIDER_BIG_ENDIAN - By default little endian register accesses are used * for the divider register. Setting this flag makes the register accesses * big endian. +* CLK_DIVIDER_REG_8BIT - by default 32bit register accesses are used for +* the gate register. Setting this flag makes the register accesses 8bit. +* CLK_DIVIDER_REG_16BIT - by default 32bit register accesses are used for +* the gate register. Setting this flag makes the register accesses 16bit. */ struct clk_divider {struct clk_hw hw;void __iomem *reg;u8 shift;u8 width; -u8 flags; +u16 flags;const struct clk_div_table *table;spinlock_t *lock; };
@@ -697,6 +707,8 @@ struct clk_divider {#define CLK_DIVIDER_READ_ONLY BIT(5)#define CLK_DIVIDER_MAX_AT_ZERO BIT(6)#define CLK_DIVIDER_BIG_ENDIAN BIT(7) +#define CLK_DIVIDER_REG_8BIT BIT(8) +#define CLK_DIVIDER_REG_16BIT BIT(9)extern const struct clk_ops clk_divider_ops;extern const struct clk_ops clk_divider_ro_ops;
@@ -726,18 +738,18 @@ struct clk_hw *__clk_hw_register_divider(struct device *dev, struct device_node *np, const char *name, const char *parent_name, const struct clk_hw *parent_hw, const struct clk_parent_data *parent_data, unsigned long flags, - void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, + void __iomem *reg, u8 shift, u8 width, u32 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock);struct clk_hw *__devm_clk_hw_register_divider (struct device *dev,struct device_node *np,const char *name,const char *parent_name,const struct clk_hw *parent_hw,const struct clk_parent_data *parent_data,unsigned long flags, -void __iomem *reg,u8 shift,u8 width,u8 clk_divider_flags, +void __iomem *reg,u8 shift,u8 width,u32 clk_divider_flags,const struct clk_div_table *table,spinlock_t *lock);struct clk *clk_register_divider_table (struct device *dev,const char *name,const char *parent_name,unsigned long flags,void __iomem *reg,u8 shift,u8 width, -u8 clk_divider_flags,const struct clk_div_table *table, +u32 clk_divider_flags,const struct clk_div_table *table,spinlock_t *lock);/** * clk_register_divider - register a divider clock with the clock framework
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 14/36 clk: renesas: Add SH7750/7751 CPG Driver
In reply to a message not in the archiveRenesas SH7750 and SH7751 series CPG driver. This driver supported frequency control and clock gating.
--- drivers/clk/renesas/Kconfig | 13 +- drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/clk-sh7750.c | 480 +++++++++++++++++++++++++++++++ 3 files changed, 491 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/renesas/clk-sh7750.c
drivers/clk/renesas/Kconfig +10 -3
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 config CLK_RENESAS - bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS - default y if ARCH_RENESAS + bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS && !SUPERH + default y if ARCH_RENESAS || SUPERH select CLK_EMEV2 if ARCH_EMEV2 select CLK_RZA1 if ARCH_R7S72100 select CLK_R7S9210 if ARCH_R7S9210
@@ -41,6 +41,9 @@ config CLK_RENESAS select CLK_R9A08G045 if ARCH_R9A08G045 select CLK_R9A09G011 if ARCH_R9A09G011 select CLK_SH73A0 if ARCH_SH73A0 + select CLK_SH7750 if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \ + CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751 || \ + CPU_SUBTYPE_SH7751R if CLK_RENESAS
@@ -198,7 +201,6 @@ config CLK_SH73A0 select CLK_RENESAS_CPG_MSTP select CLK_RENESAS_DIV6 - # Family config CLK_RCAR_CPG_LIB bool "CPG/MSSR library functions" if COMPILE_TEST
@@ -228,6 +230,11 @@ config CLK_RZG2L bool "Renesas RZ/{G2L,G2UL,G3S,V2L} family clock support" if COMPILE_TEST select RESET_CONTROLLER +config CLK_SH7750 + bool "Renesas SH7750/7751 family clock support" if COMPILE_TEST + help + This is a driver for SH7750 / SH7751 CPG. + # Generic config CLK_RENESAS_CPG_MSSR bool "CPG/MSSR clock support" if COMPILE_TEST
drivers/clk/renesas/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_CLK_R9A07G054) += r9a07g044-cpg.o obj-$(CONFIG_CLK_R9A08G045) += r9a08g045-cpg.o obj-$(CONFIG_CLK_R9A09G011) += r9a09g011-cpg.o obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o +obj-$(CONFIG_CLK_SH7750) += clk-sh7750.o # Family obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
drivers/clk/renesas/clk-sh7750.c new file +480 -0
480 lines not on this page · raw message
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 15/36 irqchip: Add SH7751 INTC driver
In reply to a message not in the archiveRenesas SH7751 Internal interrupt controller driver.
--- drivers/irqchip/Kconfig | 8 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-renesas-sh7751.c | 282 +++++++++++++++++++++++++++ 3 files changed, 291 insertions(+) create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
drivers/irqchip/Kconfig +8 -0
@@ -690,4 +690,12 @@ config SUNPLUS_SP7021_INTC chained controller, routing all interrupt source in P-Chip to the primary controller on C-Chip. +config RENESAS_SH7751_INTC + bool "Renesas SH7751 Interrupt Controller" + depends on SH_DEVICE_TREE || COMPILE_TEST + select IRQ_DOMAIN_HIERARCHY + help + Support for the Renesas SH7751 On-chip interrupt controller. + And external interrupt encoder for some targets. + endmenu
drivers/irqchip/Makefile +1 -0
@@ -121,3 +121,4 @@ obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o obj-$(CONFIG_MCHP_EIC) += irq-mchp-eic.o obj-$(CONFIG_SUNPLUS_SP7021_INTC) += irq-sp7021-intc.o +obj-$(CONFIG_RENESAS_SH7751_INTC) += irq-renesas-sh7751.o
drivers/irqchip/irq-renesas-sh7751.c new file +282 -0
282 lines not on this page · raw message
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 16/36 dt-bindings: interrupt-controller: renesas,sh7751-intc: Add json-schema
In reply to a message not in the archiveRenesas SH7751 INTC json-schema.
--- .../renesas,sh7751-intc.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +53 -0
@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-intc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7751 Interrupt Controller + +maintainers: + - Yoshinori Sato <[email protected]> + +properties: + compatible: + items: + - const: renesas,sh7751-intc + + '#interrupt-cells': + const: 1 + + interrupt-controller: true + + reg: + maxItems: 2 + + reg-names: + items: + - const: ICR + - const: INTPRI00 + + renesas,icr-irlm: + $ref: /schemas/types.yaml#/definitions/flag + description: If true four independent interrupt requests mode (ICR.IRLM is 1). + +required: + - compatible + - reg + - reg-names + - '#interrupt-cells' + - interrupt-controller + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/renesas,sh7751-intc.h> + shintc: interrupt-controller@ffd00000 { + compatible = "renesas,sh7751-intc"; + reg = <0xffd00000 14>, <0xfe080000 128>; + reg-names = "ICR", "INTPRI00"; + #interrupt-cells = <1>; + interrupt-controller; + }; +...
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 17/36 irqchip: SH7751 external interrupt encoder with enable gate.
In reply to a message not in the archiveSH7751 have 15 level external interrupt.
It is typically connected to the CPU through a priority encoder that can suppress requests.
This driver provides a way to control those hardware with irqchip.
--- drivers/irqchip/Kconfig | 7 + drivers/irqchip/Makefile | 2 + drivers/irqchip/irq-renesas-sh7751irl.c | 221 ++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/irqchip/irq-renesas-sh7751irl.c
drivers/irqchip/Kconfig +7 -0
@@ -698,4 +698,11 @@ config RENESAS_SH7751_INTC Support for the Renesas SH7751 On-chip interrupt controller. And external interrupt encoder for some targets. +config RENESAS_SH7751IRL_INTC + bool "Renesas SH7751 based target IRL encoder support." + depends on RENESAS_SH7751_INTC + help + Support for External Interrupt encoder + on the some Renesas SH7751 based target. + endmenu
drivers/irqchip/Makefile +2 -0
@@ -122,3 +122,5 @@ obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o obj-$(CONFIG_MCHP_EIC) += irq-mchp-eic.o obj-$(CONFIG_SUNPLUS_SP7021_INTC) += irq-sp7021-intc.o obj-$(CONFIG_RENESAS_SH7751_INTC) += irq-renesas-sh7751.o +obj-$(CONFIG_RENESAS_SH7751IRL_INTC) += irq-renesas-sh7751irl.o +
drivers/irqchip/irq-renesas-sh7751irl.c new file +221 -0
221 lines not on this page · raw message
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 18/36 dt-bindings: interrupt-controller: renesas,sh7751-irl-ext: Add json-schema
In reply to a message not in the archiveRenesas SH7751 external interrupt encoder json-schema.
--- .../renesas,sh7751-irl-ext.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +57 -0
@@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-irl-ext.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7751 external interrupt encoder with enable regs. + +maintainers: + - Yoshinori Sato <[email protected]> + +description: + This is the generally used external interrupt encoder on SH7751 based boards. + +properties: + compatible: + items: + - const: renesas,sh7751-irl-ext + + reg: true + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + + '#address-cells': + const: 0 + + renesas,set-to-disable: + $ref: /schemas/types.yaml#/definitions/flag + description: Invert enable registers. Setting the bit to 0 enables interrupts. + + renesas,enable-reg: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + IRQ enable register bit mapping + +required: + - compatible + - reg + - interrupt-controller + - '#interrupt-cells' + - renesas,enable-reg + +additionalProperties: false + +examples: + - | + r2dintc: interrupt-controller@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + renesas,enable-reg = <12 9 10 3 0 4 1 2 8 5 6 7 15 15 15 11>; + };
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 19/36 serial: sh-sci: fix SH4 OF support.
In reply to a message not in the archive- fix earlycon name.
- fix earlyprintk hung (NULL pointer reference).
- fix SERIAL_SH_SCI_EARLYCON enablement
--- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/sh-sci.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/Kconfig +1 -1
@@ -661,7 +661,7 @@ config SERIAL_SH_SCI_EARLYCON depends on SERIAL_SH_SCI=y select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON - default ARCH_RENESAS + default ARCH_RENESAS || SUPERH config SERIAL_SH_SCI_DMA bool "DMA support" if EXPERT
drivers/tty/serial/sh-sci.c +3 -3
@@ -2717,7 +2717,7 @@ static int sci_remap_port(struct uart_port *port)if (port->membase)return 0 ; -if (port->dev->of_node || (port->flags &UPF_IOREMAP )) { +if ((port->dev && port->dev->of_node) || (port->flags &UPF_IOREMAP )) { port->membase =ioremap (port->mapbase, sport->reg_size);if (unlikely (!port->membase)) {dev_err (port->dev,"can't remap port#%d\n" , port->line);
@@ -3545,8 +3545,8 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,OF_EARLYCON_DECLARE (sci,"renesas,sci" , sci_early_console_setup);OF_EARLYCON_DECLARE (scif,"renesas,scif" , scif_early_console_setup); -OF_EARLYCON_DECLARE (scif,"renesas,scif-r7s9210" , rzscifa_early_console_setup); -OF_EARLYCON_DECLARE (scif,"renesas,scif-r9a07g044" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscifa,"renesas,scif-r7s9210" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscifa,"renesas,scif-r9a07g044" , rzscifa_early_console_setup);OF_EARLYCON_DECLARE (scifa,"renesas,scifa" , scifa_early_console_setup);OF_EARLYCON_DECLARE (scifb,"renesas,scifb" , scifb_early_console_setup);OF_EARLYCON_DECLARE (hscif,"renesas,hscif" , hscif_early_console_setup);
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 20/36 dt-bindings: serial: renesas,scif: Add scif-sh7751.
In reply to a message not in the archiveAdd Renesas SH7751 SCIF.
--- Documentation/devicetree/bindings/serial/renesas,scif.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/renesas,scif.yaml +1 -0
@@ -18,6 +18,7 @@ properties: - items: - enum: - renesas,scif-r7s72100 # RZ/A1H + - renesas,scif-sh7751 # SH7751 - const: renesas,scif # generic SCIF compatible UART - items:
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 21/36 dt-bindings: display: smi,sm501: SMI SM501 binding json-schema
In reply to a message not in the archive--- .../bindings/display/smi,sm501.yaml | 398 ++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/smi,sm501.yaml
Documentation/devicetree/bindings/display/smi,sm501.yaml new file +398 -0
@@ -0,0 +1,398 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/smi,sm501.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Silicon Motion SM501 Mobile Multimedia Companion Chip + +maintainers: + - Yoshinori Sato <[email protected]> + +description: | + These DT bindings describe the SM501. + +properties: + compatible: + const: + smi,sm501 + + reg: + maxItems: 2 + description: | + First entry: System Configuration register + Second entry: IO space (Display Controller register) + + interrupts: + description: SM501 interrupt to the cpu should be described here. + + mode: + $ref: /schemas/types.yaml#/definitions/string + description: select a video mode + + edid: + description: | + verbatim EDID data block describing attached display. + Data from the detailed timing descriptor will be used to + program the display controller. + + little-endian: + $ref: /schemas/types.yaml#/definitions/flag + description: available on big endian systems, to set different foreign endian. + big-endian: + $ref: /schemas/types.yaml#/definitions/flag + description: available on little endian systems, to set different foreign endian. + + swap-fb-endian: + $ref: /schemas/types.yaml#/definitions/flag + description: swap framebuffer byteorder. + + route-crt-panel: + $ref: /schemas/types.yaml#/definitions/flag + description: Panel output merge to CRT. + + crt: + type: object + description: CRT output control + properties: + edid: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: | + verbatim EDID data block describing attached display. + Data from the detailed timing descriptor will be used to + program the display controller. + + smi,flags: + $ref: /schemas/types.yaml#/definitions/string-array + description: Display control flags. + items: + anyOf: + - const: use-init-done + - const: disable-at-exit + - const: use-hwcursor + - const: use-hwaccel + - const: panel-no-fpen + - const: panel-no-vbiasen + - const: panel-inv-fpen + - const: panel-inv-vbiasen + maxItems: 8 + + bpp: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Color depth + + panel: + type: object + description: Panel output control + properties: + edid: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: | + verbatim EDID data block describing attached display. + Data from the detailed timing descriptor will be used to + program the display controller. + + smi,flags: + $ref: /schemas/types.yaml#/definitions/string-array + description: Display control flags. + items: + anyOf: + - const: use-init-done + - const: disable-at-exit + - const: use-hwcursor + - const: use-hwaccel + - const: panel-no-fpen + - const: panel-no-vbiasen + - const: panel-inv-fpen + - const: panel-inv-vbiasen + maxItems: 8 + + bpp: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Color depth + + smi,devices: + $ref: /schemas/types.yaml#/definitions/string-array + description: Select SM501 device functions. + items: + anyOf: + - const: usb-host + - const: usb-slave + - const: ssp0 + - const: ssp1 + - const: uart0 + - const: uart1 + - const: fbaccel + - const: ac97 + - const: i2s + - const: gpio + minItems: 1 + maxItems: 10 + + smi,mclk: + $ref: /schemas/types.yaml#/definitions/uint32 + description: mclk frequency. + + smi,m1xclk: + $ref: /schemas/types.yaml#/definitions/uint32 + description: m1xclk frequency. + + misc-timing: + type: object + description: Miscellaneous Timing register values. + properties: + ex: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Extend bus holding time. + + xc: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Xscale clock input select. + + usb-over-current-detect-disable: + $ref: /schemas/types.yaml#/definitions/flag + description: USB host current detection disable (Us=0). + + usb-over-current-detect-enable: + $ref: /schemas/types.yaml#/definitions/flag + description: USB host current detection disable (Us=1). + + sdram-clock-mode1-288mhz: + $ref: /schemas/types.yaml#/definitions/flag + description: SSM1 bit is clear. + + sdram-clock-mode1-div: + $ref: /schemas/types.yaml#/definitions/flag + description: SSM1 bit is set. + + sm1: + $ref: /schemas/types.yaml#/definitions/flag + description: SDRAM clock divider for PW mode 1. + + sdram-clock-mode0-288mhz: + $ref: /schemas/types.yaml#/definitions/flag + description: SSM0 bit is clear. + + sdram-clock-mode0-div: + $ref: /schemas/types.yaml#/definitions/flag + description: SSM0 bit is set. + + sm0: + $ref: /schemas/types.yaml#/definitions/uint32 + description: SDRAM clock divider for PW mode 0. + + pll-debug-input: + $ref: /schemas/types.yaml#/definitions/flag + description: 96MHz PLL debug input reference frequency (Deb=0). + + pll-debug-output: + $ref: /schemas/types.yaml#/definitions/flag + description: 96MHz PLL debug output frequency (Deb=1). + + no-acpi-control: + $ref: /schemas/types.yaml#/definitions/flag + description: No ACPI control (A=0). + + acpi-control: + $ref: /schemas/types.yaml#/definitions/flag + description: No ACPI control (A=1). + + divider: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Second PLL output frequency. + + usb-host-normal: + $ref: /schemas/types.yaml#/definitions/flag + description: USB Host normal mode. + + usb-host-simulation: + $ref: /schemas/types.yaml#/definitions/flag + description: USB Host simulation mode. + + delay: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Delay time to latch read data. Set the value to 10x. + + misc-control: + type: object + description: Miscellaneous Control register values. + properties: + pad: + $ref: /schemas/types.yaml#/definitions/uint32 + description: PCI Pad drive strength. + + usbclk: + $ref: /schemas/types.yaml#/definitions/uint32 + description: USB Clcok Select. + + uart1: + $ref: /schemas/types.yaml#/definitions/flag + description: UART1 (SSP=0) + + ssp1: + $ref: /schemas/types.yaml#/definitions/flag + description: SSP1 (SSP=1) + + latch-address-disable: + $ref: /schemas/types.yaml#/definitions/flag + description: 8051 Latch disable (Lat=0). + + latch-address-enable: + $ref: /schemas/types.yaml#/definitions/flag + description: 8051 Latch enable (Lat=1). + + panel-data-18bit: + $ref: /schemas/types.yaml#/definitions/flag + description: Flat Panel data 18bit (FP=0). + + panel-data-24bit: + $ref: /schemas/types.yaml#/definitions/flag + description: Flat Panel data 24bit (FP=1). + + xtal-freq-24mhz: + $ref: /schemas/types.yaml#/definitions/flag + description: Crystal frequency 24MHz (Freq=0). + + xtal-freq-12mhz: + $ref: /schemas/types.yaml#/definitions/flag + description: Crystal frequency 12MHz (Freq=1). + + refresh: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Internal memory refresh timing. + + hold: + $ref: /schemas/types.yaml#/definitions/uint32 + description: BUS Hold time. + + sh-ready-low: + $ref: /schemas/types.yaml#/definitions/flag + description: SuperH ready polarity active low (SH=0). + + sh-ready-high: + $ref: /schemas/types.yaml#/definitions/flag + description: SuperH ready polarity active high (SH=1). + + interrupt-normal: + $ref: /schemas/types.yaml#/definitions/flag + description: Interrupt normal (II=0). + + interrupt-inverted: + $ref: /schemas/types.yaml#/definitions/flag + description: Interrupt Inverting (II=1). + + pll-clock-count-disable: + $ref: /schemas/types.yaml#/definitions/flag + description: PLL clock count disable. + + pll-clock-count-enaable: + $ref: /schemas/types.yaml#/definitions/flag + description: PLL clock count enable. + + dac-power-enable: + $ref: /schemas/types.yaml#/definitions/flag + description: DAC Power enable (DAC=0). + + dac-power-disable: + $ref: /schemas/types.yaml#/definitions/flag + description: DAC Power disable (DAC=1). + + usb-slave-cpu: + $ref: /schemas/types.yaml#/definitions/flag + description: USB slave controller cpu (MC=0). + + usb-slave-8051: + $ref: /schemas/types.yaml#/definitions/flag + description: USB slave controller 8051MCU (MC=1). + + burst-length-8: + $ref: /schemas/types.yaml#/definitions/flag + description: CPU Master burst length 8 (BL=0). + + burst-length-1: + $ref: /schemas/types.yaml#/definitions/flag + description: CPU Master burst length 1 (BL=1). + + usb-port-master: + $ref: /schemas/types.yaml#/definitions/flag + description: USB port master. + + usb-port-slave: + $ref: /schemas/types.yaml#/definitions/flag + description: USB port slave. + + vr-mmio-30mb: + $ref: /schemas/types.yaml#/definitions/flag + description: NEC VR Memory map MMIO locatedat 30MB (VR=0) + + vr-mmio-62mb: + $ref: /schemas/types.yaml#/definitions/flag + description: NEC VR Memory map MMIO locatedat 62MB (VR=1) + + gpio-pin-control: + type: object + description: GPIO control configuration. + properties: + pin: + type: object + properties: + gpio: + $ref: /schemas/types.yaml#/definitions/flag + description: pin in/out use GPIO. + function: + $ref: /schemas/types.yaml#/definitions/flag + description: pin in/out use function. + + gpio-i2c: + type: object + description: GPIO I2C definition. + properties: + i2c: + type: object + properties: + bus: + $ref: /schemas/types.yaml#/definitions/uint32 + description: I2C bus number. + + sda: + $ref: /schemas/types.yaml#/definitions/uint32 + description: I2C SDA pin port number. + + scl: + $ref: /schemas/types.yaml#/definitions/uint32 + description: I2C SCL pin port number. + + delay: + $ref: /schemas/types.yaml#/definitions/uint32 + description: bit transmission delay. + + timeout: + $ref: /schemas/types.yaml#/definitions/uint32 + description: transmission timeout. + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + + +examples: + # MPC5200 + - | + display@1,0 { + compatible = "smi,sm501"; + reg = <0x00000000 0x00800000 + 0x03e00000 0x00200000>; + interrupts = <1 1 3>; + mode = "640x480-32@60"; + edid = [00 ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 + 00 00 01 04 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 f0 0a 80 fb 20 e0 25 10 32 60 + 02 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 bd]; + };
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 22/36 dt-bindings: display: sm501 register definition helper
In reply to a message not in the archiveMiscellaneous Timing and Miscellaneous Control registers definition.
--- include/dt-bindings/display/sm501.h | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 include/dt-bindings/display/sm501.h
include/dt-bindings/display/sm501.h new file +76 -0
@@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ +#ifndef __DT_BINDING_DISPALY_SM501__ +#define __DT_BINDING_DISPALY_SM501__ + +/* Miscellaneous Conntrol */ +#define SM501_MISC_CONTROL_PAD_24 0 +#define SM501_MISC_CONTROL_PAD_12 1 +#define SM501_MISC_CONTROL_PAD_8 2 + +#define SM501_MISC_CONTROL_USBCLK_XTAL 0 +#define SM501_MISC_CONTROL_USBCLK_96MHZ 1 +#define SM501_MISC_CONTROL_USBCLK_48MHZ 2 + +#define SM501_MISC_CONTROL_RFSH_8US 0 +#define SM501_MISC_CONTROL_RFSH_16US 1 +#define SM501_MISC_CONTROL_RFSH_32US 2 +#define SM501_MISC_CONTROL_RFSH_64US 3 + +#define SM501_MISC_CONTROL_HOLD_EMPTY 0 +#define SM501_MISC_CONTROL_HOLD_8TR 1 +#define SM501_MISC_CONTROL_HOLD_16TR 2 +#define SM501_MISC_CONTROL_HOLD_24TR 3 +#define SM501_MISC_CONTROL_HOLD_32TR 4 + +/* Miscellaneous timing */ +#define SM501_MISC_TIMING_EX_HOLD_0 0 +#define SM501_MISC_TIMING_EX_HOLD_16 1 +#define SM501_MISC_TIMING_EX_HOLD_32 2 +#define SM501_MISC_TIMING_EX_HOLD_48 3 +#define SM501_MISC_TIMING_EX_HOLD_64 4 +#define SM501_MISC_TIMING_EX_HOLD_80 5 +#define SM501_MISC_TIMING_EX_HOLD_96 6 +#define SM501_MISC_TIMING_EX_HOLD_112 7 +#define SM501_MISC_TIMING_EX_HOLD_128 8 +#define SM501_MISC_TIMING_EX_HOLD_144 9 +#define SM501_MISC_TIMING_EX_HOLD_160 10 +#define SM501_MISC_TIMING_EX_HOLD_176 11 +#define SM501_MISC_TIMING_EX_HOLD_192 12 +#define SM501_MISC_TIMING_EX_HOLD_208 13 +#define SM501_MISC_TIMING_EX_HOLD_224 14 +#define SM501_MISC_TIMING_EX_HOLD_240 15 + +#define SM501_MISC_TIMING_XC_INTERNAL 0 +#define SM501_MISC_TIMING_XC_HCLK 1 +#define SM501_MISC_TIMING_XC_GPIO 2 + +#define SM501_MISC_TIMING_SM_DIV1 0 +#define SM501_MISC_TIMING_SM_DIV2 1 +#define SM501_MISC_TIMING_SM_DIV4 2 +#define SM501_MISC_TIMING_SM_DIV8 3 +#define SM501_MISC_TIMING_SM_DIV16 4 +#define SM501_MISC_TIMING_SM_DIV32 5 +#define SM501_MISC_TIMING_SM_DIV64 6 +#define SM501_MISC_TIMING_SM_DIV128 7 +#define SM501_MISC_TIMING_SM_DIV3 8 +#define SM501_MISC_TIMING_SM_DIV6 9 +#define SM501_MISC_TIMING_SM_DIV12 10 +#define SM501_MISC_TIMING_SM_DIV24 11 +#define SM501_MISC_TIMING_SM_DIV48 12 +#define SM501_MISC_TIMING_SM_DIV96 13 +#define SM501_MISC_TIMING_SM_DIV192 14 +#define SM501_MISC_TIMING_SM_DIV384 15 + +#define SM501_MISC_TIMING_DIV336MHZ 0 +#define SM501_MISC_TIMING_DIV288MHZ 1 +#define SM501_MISC_TIMING_DIV240MHZ 2 +#define SM501_MISC_TIMING_DIV192MHZ 3 + +#define SM501_MISC_TIMING_DELAY_NONE 0 +#define SM501_MISC_TIMING_DELAY_0_5 1 +#define SM501_MISC_TIMING_DELAY_1_0 2 +#define SM501_MISC_TIMING_DELAY_1_5 3 +#define SM501_MISC_TIMING_DELAY_2_0 4 +#define SM501_MISC_TIMING_DELAY_2_5 5 + +#endif
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 23/36 mfd: sm501: Convert platform_data to OF property
In reply to a message not in the archiveVarious parameters of SM501 can be set using platform_data, so parameters cannot be passed in the DeviceTree target. Expands the parameters set in platform_data so that they can be specified using DeviceTree properties.
--- drivers/mfd/sm501.c | 315 ++++++++++++++++++++++++++++++++++ drivers/video/fbdev/sm501fb.c | 106 ++++++++++++ 2 files changed, 421 insertions(+)
drivers/mfd/sm501.c +315 -0
@@ -82,6 +82,16 @@ struct sm501_devdata {unsigned int rev; }; +struct sm501_config_props_uint { +char *name; +u32 shift; +}; + +struct sm501_config_props_flag { +char *clr_name; +char *set_name; +u32 bit; +};#define MHZ (1000 * 1000)
@@ -1370,6 +1380,305 @@ static int sm501_init_dev(struct sm501_devdata *sm)return 0 ; } +static const struct sm501_config_props_uint misc_timing[] = { + {"delay" ,0 }, + {"-" ,3 }, + {"divider" ,4 }, + {"-" ,6 }, + {"sm0" ,8 }, + {"-" ,12 }, + {"sm1" ,16 }, + {"-" ,20 }, + {"xc" ,24 }, + {"-" ,26 }, + {"ex" ,28 }, + {NULL ,32 }, +}; + +static const struct sm501_config_props_flag misc_timing_flag[] = { + {"usb-host-normal" ,"usb-host-simulation" ,3 }, + {"no-acpi-control" ,"acpi-control" ,6 }, + {"pll-debug-input" ,"pll-debug-output" ,7 }, + {"sdram-clock-mode0-288mhz" ,"sdram-clock-mode0-div" ,12 }, + {"sdram-clock-mode1-288mhz" ,"sdram-clock-mode1-div" ,20 }, + {"usb-over-current-detect-disable" , +"usb-over-current-detect-enable" ,23 }, + {}, +}; + +static const struct sm501_config_props_uint misc_control[] = { + {"hold" ,18 }, + {"refresh" ,21 }, + {"-" ,23 }, + {"usbclk" ,28 }, + {"pad" ,30 }, + {NULL ,32 }, +}; + +static const struct sm501_config_props_flag misc_control_flag[] = { + {"vr-mmio-30mb" ,"vr-mmio-62mb" ,4 }, + {"usb-port-master" ,"usb-port-slave" ,9 }, + {"burst-length-8" ,"burst-length-1" ,10 }, + {"usb-slave-cpu" ,"usb-slave-8051" ,11 }, + {"dac-power-enable" ,"dac-power-disable" ,12 }, + {"pll-clock-count-disable" ,"pll-clock-count-enable" ,15 }, + {"interrupt-normal" ,"interrupt-invarted" ,16 }, + {"sh-ready-low" ,"sh-ready-high" ,17 }, + {"xtal-freq-24mhz" ,"xtal-freq-12mhz" ,24 }, + {"panel-data-18bit" ,"panel-dtat-24bit" ,25 }, + {"latch-address-disable" ,"latch-address-enable" ,26 }, + {"uart1" ,"ssp1" ,27 }, + {}, +}; + +/* Read configuration values */ +static void sm501_of_read_config (struct device *dev,struct device_node *np, +const char *prefix, +const struct sm501_config_props_uint *props, +const struct sm501_config_props_flag *props_flag, +struct sm501_reg_init *ret) +{ +struct device_node *child; +char *name; +u32 shift; +u32 width; +u32 mask; +u32 val; + + ret->mask = ~0 ; + ret->set =0 ; + + child =of_get_child_by_name (np, prefix); +if (!child) +return ; + +while (props->name) { + name = props->name; + shift = props->shift; + props++; + +if (name[0 ] =='-' || +of_property_read_u32 (child, name, &val)) +continue ; + + width = props->shift - shift; + mask = (1 << width) -1 ; +if (mask < val) { +dev_warn (dev,"%s invalid value %d" , name, val); +continue ; + } + mask = ~(mask << shift); + ret->mask &= mask; + ret->set |= val << shift; + } +while (props_flag->clr_name) { + val = ~0 ; +if (of_property_read_bool (child, props_flag->clr_name)) + val =0 ; +else if (of_property_read_bool (child, props_flag->set_name)) + val =1 ; +if (val != ~0 ) { + val <<= (props_flag->bit &31 ); + mask =1 << (props_flag->bit &31 ); + ret->mask &= ~mask; + ret->set |= val; + } + props_flag++; + } +} + +/* Read GPIO control */ +/* +* DT example. +* gpio-pin-control { +* pin@0 { +* gpio-port; +* }; +* pin@1 { +* function; +* }; +* }; +*/ +static void sm501_of_read_gpio (struct device *dev,struct device_node *np, +struct sm501_reg_init *hi,struct sm501_reg_init *low) +{ +struct device_node *gpio_group, *pin; +const char *prop_mode; +unsigned int pin_no; +int mode; +u64 mask; +u64 set; + + mask = ~0 ; + set =0 ; + gpio_group =of_get_child_by_name (np,"gpio-pin-control" ); +if (gpio_group) { +for_each_child_of_node (gpio_group, pin) { + mode =-1 ; +if (sscanf (pin->full_name,"pin@%u" , &pin_no) ==1 ) { +if (of_property_read_bool (pin,"gpio-port" )) + mode =0 ; +else if (of_property_read_bool (pin,"function" )) + mode =1 ; + } +/* GPIO0 - 47 and 55 -63 */ +if (mode <0 || + (pin_no >=64 || (pin_no >=48 && pin_no <=54 ))) { +dev_warn (dev, +"%s mode %s is invalid." , pin->name, prop_mode); + }else { + mask &= ~(1 << pin_no); + set |= mode << pin_no; + } + } + } + hi->set = set >>32 ; + low->set = set &0xffffffff ; + hi->mask = mask >>32 ; + low->mask = mask &0xffffffff ; +} + +static inline int read_i2c_prop (struct device *dev,struct device_node *child, +const char *name,u32 *val) +{ +if (of_property_read_u32 (child, name, val)) { +dev_warn (dev,"%s/%s not found. skip it." ,of_node_full_name (child), name); +return -ENOENT ; + } +return 0 ; +} + +/* Read GPIO I2C configuration */ +/* +* DT example. +* gpio-i2c { +* i2c@0 { +* sda = <gpio-pin>; +* scl = <gpio-pin>; +* delay = <delay>; +* timeout = <timeout>; +* }; +* i2c@1 { +* : +* }; +* : +* }; +*/ +static int sm501_parse_dt_gpio_i2c (struct device *dev,struct sm501_platdata *plat, +struct device_node *np) +{ +struct device_node *i2c_group, *child; +unsigned int i; +u32 i2c_nr; +int err; + + i2c_group =of_get_child_by_name (np,"gpio-i2c" ); +if (!i2c_group) +return 0 ; + + i2c_nr =of_get_child_count (i2c_group); + plat->gpio_i2c =devm_kzalloc (dev,sizeof (*plat->gpio_i2c) * i2c_nr, +GFP_KERNEL ); +if (!plat->gpio_i2c) +return -ENOMEM ; + + plat->gpio_i2c_nr = i2c_nr; + i =0 ; +for_each_child_of_node (i2c_group, child) { +u32 bus; + +if (sscanf (child->full_name,"i2c@%u" , &bus) !=1 ) { +dev_warn (dev,"Unknown address %s\n" , child->name); +continue ; + } + + err =0 ; + plat->gpio_i2c[i].bus_num = bus; + err +=read_i2c_prop (dev, child,"sda" , &plat->gpio_i2c[i].pin_sda); + err +=read_i2c_prop (dev, child,"scl" , &plat->gpio_i2c[i].pin_scl); + err +=read_i2c_prop (dev, child,"delay" , &plat->gpio_i2c[i].udelay); + err +=read_i2c_prop (dev, child,"timeout" , &plat->gpio_i2c[i].timeout); +if (err ==0 ) + i++; + } + +return 0 ; +} + +/* Read device functions */ +static u32 sm501_read_devices (struct device *dev,struct device_node *np) +{ +static const char *const funcname[] = { +"usb-host" ,"usb-slave" ,"ssp0" ,"ssp1" , +"uart0" ,"uart1" ,"fbaccel" ,"ac97" , +"i2s" ,"gpio" , + }; +struct property *prop; +unsigned int i; +const char *s; +u32 ret =0 ; + +of_property_for_each_string (np,"smi,devices" , prop, s) { +for (i =0 ; i <ARRAY_SIZE (funcname); i++) { +if (strcmp (s, funcname[i]) ==0 ) { + ret |=1 << i; + goto next; + } + } +dev_warn (dev,"Unknown device function '%s'" , s); +next: + } +if (!ret) +dev_warn (dev,"devices not defined. disable all functions." ); +return ret; +} + +/* Build platform_data from OF property */ +struct plat_dt { +struct sm501_platdata plat; +struct sm501_initdata init; +}; + +static int sm501_parse_dt (struct sm501_devdata *sm,struct device_node *np) +{ +struct sm501_platdata *plat; +struct plat_dt *dt_p; +u32 word; +int ret; + + dt_p =devm_kzalloc (sm->dev,sizeof (*dt_p),GFP_KERNEL ); +if (!dt_p) +return -ENOMEM ; + + plat = &dt_p->plat; + plat->init = &dt_p->init; + + plat->init->devices =sm501_read_devices (sm->dev, np); +/* mclk and m1xclk are not u32, so convert between them using intermediate variables. */ +of_property_read_u32 (np,"smi,mclk" , &word); + plat->init->mclk = word; +of_property_read_u32 (np,"smi,m1xclk" , &word); + plat->init->m1xclk = word; + +sm501_of_read_config (sm->dev, np,"misc-timing" , + misc_timing, misc_timing_flag, + &plat->init->misc_timing); +sm501_of_read_config (sm->dev, np,"misc-control" , + misc_control, misc_control_flag, + &plat->init->misc_control); +sm501_of_read_gpio (sm->dev, np, + &plat->init->gpio_high, &plat->init->gpio_low); + +if (IS_ENABLED (CONFIG_MFD_SM501_GPIO ) && + (plat->init->devices &SM501_USE_GPIO )) { + ret =sm501_parse_dt_gpio_i2c (sm->dev, plat, np); +if (ret) +return ret; + } + sm->platdata = plat; +return 0 ; +} +static int sm501_plat_probe (struct platform_device *dev) {struct sm501_devdata *sm;
@@ -1406,6 +1715,12 @@ static int sm501_plat_probe(struct platform_device *dev) goto err_res; } +if (IS_ENABLED (CONFIG_OF ) && dev->dev.of_node) { + ret =sm501_parse_dt (sm, dev->dev.of_node); +if (ret) + goto err_res; + } +platform_set_drvdata (dev, sm); sm->regs =ioremap (sm->io_res->start,resource_size (sm->io_res));
drivers/video/fbdev/sm501fb.c +106 -0
118 lines not on this page · raw message
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerPATCH v7 24/36 dt-binding: sh: cpus: Add SH CPUs json-schema
In reply to a message not in the archiveRenesas SH series and compatible ISA CPUs.
--- .../devicetree/bindings/sh/cpus.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/sh/cpus.yaml
Documentation/devicetree/bindings/sh/cpus.yaml new file +61 -0
@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sh/cpus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SuperH CPUs + +maintainers: + - Yoshinori Sato <[email protected]> + +description: |+ + Definition of CPU core with Renesas SuperH and compatible instruction set. + +properties: + compatible: + anyOf: + - items: + - enum: + - renesas,sh2a + - renesas,sh3 + - renesas,sh4 + - renesas,sh4a + - jcore,j2 + - const: renesas,sh2 + - const: renesas,sh2 + + clocks: + maxItems: 1 + + reg: + maxItems: 1 + + device_type: true + +required: + - compatible + - reg + - device_type + + +examples: + - | + #include <dt-bindings/clock/sh7750-cpg.h> + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu: cpu@0 { + compatible = "renesas,sh4", "renesas,sh2"; + device_type = "cpu"; + reg = <0>; + clocks = <&cpg SH7750_CPG_ICK>; + clock-names = "ick"; + icache-size = <16384>; + icache-line-size = <32>; + dcache-size = <32768>; + dcache-line-size = <32>; + }; + }; +...
Signature · 1 line
2.39.2
Re: [DO NOT MERGE v7 19/36] serial: sh-sci: fix SH4 OF support.
In reply to Yoshinori SatoHi Sato-san,
Thanks for the update!
Quoted 1 line · Yoshinori Sato
- fix earlycon name.
Might be wise to explain what was wrong with it...
(because else "scif" will invoke rzscifa_early_console_setup()
on non-DT platforms)
Quoted 9 lines
- fix earlyprintk hung (NULL pointer reference).
- fixSERIAL_SH_SCI_EARLYCONenablementSigned-off-by Yoshinori Sato <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>
drivers/tty/serial/sh-sci.c static int sci_remap_port(struct uart_port *port) · line 2720
Quoted 5 lines
drivers/tty/serial/sh-sci.c +1
-1@@ -2717,7 +2717,7 @@ static int sci_remap_port(struct uart_port *port)if (port->membase)return 0 ; -if (port->dev->of_node || (port->flags &UPF_IOREMAP )) { +if ((port->dev && port->dev->of_node) || (port->flags &UPF_IOREMAP )) {
Looks like the dev_of_node() wrapper exists to handle this.
Quoted 4 lines
drivers/tty/serial/sh-sci.c +0
-0port->membase =ioremap (port->mapbase, sport->reg_size);if (unlikely (!port->membase)) {dev_err (port->dev,"can't remap port#%d\n" , port->line);
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3552
Quoted 10 lines
drivers/tty/serial/sh-sci.c +2
-2@@ -3545,8 +3545,8 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,OF_EARLYCON_DECLARE (sci,"renesas,sci" , sci_early_console_setup);OF_EARLYCON_DECLARE (scif,"renesas,scif" , scif_early_console_setup); -OF_EARLYCON_DECLARE (scif,"renesas,scif-r7s9210" , rzscifa_early_console_setup); -OF_EARLYCON_DECLARE (scif,"renesas,scif-r9a07g044" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscifa,"renesas,scif-r7s9210" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscifa,"renesas,scif-r9a07g044" , rzscifa_early_console_setup);OF_EARLYCON_DECLARE (scifa,"renesas,scifa" , scifa_early_console_setup);OF_EARLYCON_DECLARE (scifb,"renesas,scifb" , scifb_early_console_setup);OF_EARLYCON_DECLARE (hscif,"renesas,hscif" , hscif_early_console_setup);
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds