Skip to contentSkip to conversation

Add basic reset driver for assert/deassert operations

PATCH In review Sergiu Moga 2 participants 4 messages Jan 4, 2023 – Jan 5, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Add basic reset driver for assert/deassert operations

This patch series originates from:
https://lists.denx.de/pipermail/u-boot/2022-December/502865.html

Implement a basic driver to enable assert/deassert operations.

v1 -> v2:
- rebase on u-boot next

Cristian Birsan (1):
ARM: at91: add sama7 SFR definitions

Sergiu Moga (1):
reset: at91: Add reset driver for basic assert/deassert operations

 arch/arm/mach-at91/include/mach/sama7-sfr.h |  59 ++++++++
 drivers/reset/Kconfig                       |   8 ++
 drivers/reset/Makefile                      |   1 +
 drivers/reset/reset-at91.c                  | 141 ++++++++++++++++++++
 drivers/sysreset/sysreset_at91.c            |   9 +-
 5 files changed, 210 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/mach-at91/include/mach/sama7-sfr.h
 create mode 100644 drivers/reset/reset-at91.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 ARM: at91: add sama7 SFR definitions

From: Cristian Birsan <[email protected]>

Special Function Registers(SFR) definitions for SAMA7 product family.

---

v1 -> v2:
- nothing

 arch/arm/mach-at91/include/mach/sama7-sfr.h | 59 +++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/sama7-sfr.h
arch/arm/mach-at91/include/mach/sama7-sfr.h new file +59 -0
new file mode 100644
index 0000000000..a987ff5465
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Microchip SFR (Special Function Registers) registers for SAMA7 family.
+ *
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Cristian Birsan <[email protected]>
+ */
+
+#ifndef _LINUX_MFD_SYSCON_AT91_SAMA7_SFR_H
+#define _LINUX_MFD_SYSCON_AT91_SAMA7_SFR_H
+
+#define SAMA7_SFR_OHCIICR	0x00	/* OHCI INT Configuration Register */
+#define SAMA7_SFR_OHCIISR	0x04	/* OHCI INT Status Register */
+/* 0x08 ~ 0xe3: Reserved */
+#define SAMA7_SFR_WPMR		0xe4	/* Write Protection Mode Register */
+#define SAMA7_SFR_WPSR		0xe4	/* Write Protection Status Register */
+/* 0xec ~ 0x200b: Reserved */
+#define SAMA7_SFR_DEBUG		0x200c	/* Debug Register */
+
+/* 0x2010 ~ 0x2027: Reserved */
+#define SAMA7_SFR_EHCIOHCI	0x2020  /* EHCI OHCI Clock Configuration Reg */
+
+#define SAMA7_SFR_HSS_AXI_QOS	0x2028	/* HSS AXI QOS Register */
+#define SAMA7_SFR_UDDRC		0x202c  /* UDDRC Register */
+#define SAMA7_SFR_CAN_SRAM_SEL	0x2030	/* CAN SRAM Select. Register */
+/* 0x2034 ~ 0x203f: Reserved */
+
+#define SAMA7_SFR_UTMI0		0x2040
+#define SAMA7_SFR_UTMI0R(x)	(SAMA7_SFR_UTMI0 + 4 * (x))
+
+#define SAMA7_SFR_UTMI0R0	0x2040	/* UTMI0 Configuration Register */
+#define SAMA7_SFR_UTMI0R1	0x2044	/* UTMI1 Configuration Register */
+#define SAMA7_SFR_UTMI0R2	0x2048	/* UTMI2 Configuration Register */
+
+/* Field definitions */
+#define SAMA7_SFR_OHCIICR_ARIE			BIT(0)
+#define SAMA7_SFR_OHCIICR_APPSTART		BIT(1)
+#define SAMA7_SFR_OHCIICR_USB_SUSP(x)		BIT(8 + (x))
+#define SAMA7_SFR_OHCIICR_USB_SUSPEND		GENMASK(10, 8)
+
+#define SAMA7_SFR_OHCIISR_RIS(x)		BIT(x)
+
+#define SAMA7_SFR_WPMR_WPEN			BIT(0)
+#define SAMA7_SFR_WPMR_KEY			0x53465200 /* SFR in ASCII*/
+#define SAMA7_SFR_WPMR_WPKEY_MASK		GENMASK(31, 8)
+
+#define SAMA7_SFR_WPSR_WPSRC_MASK		GENMASK(23, 8)
+#define SAMA7_SFR_WPSR_WPVS_MASK		BIT(0)
+
+#define SAMA7_SFR_CAN_SRAM_UPPER(x)		BIT(x)
+
+#define SAMA7_SFR_UTMI_RX_VBUS			BIT(25) /* VBUS Valid bit */
+#define SAMA7_SFR_UTMI_RX_TX_PREEM_AMP_TUNE_1X	BIT(23) /* TXPREEMPAMPTUNE 1x */
+#define SAMA7_SFR_UTMI_COMMONON			BIT(3)  /* PLL Common ON bit */
+
+#define SAMA7_SFR_EHCIOHCI_PHYCLK		BIT(1)  /* Alternate PHY Clk */
+
+#endif /* _LINUX_MFD_SYSCON_AT91_SAMA7_SFR_H */
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 reset: at91: Add reset driver for basic assert/deassert operations

In reply to Sergiu Moga

Add support for at91 reset controller's basic assert/deassert operations. Since this driver conflicts with the SYSRESET driver because they both bind to the same RSTC node, implement a custom bind hook that would manually bind the sysreset driver, if enabled, to the same RSTC DT node. Furthermore, delete the no longer needed compatibles from the SYSRESET driver and rename it to make sure than any possible conflicts are avoided.

---

v1 -> v2:
- rebase on u-boot next

 drivers/reset/Kconfig            |   8 ++
 drivers/reset/Makefile           |   1 +
 drivers/reset/reset-at91.c       | 141 +++++++++++++++++++++++++++++++
 drivers/sysreset/sysreset_at91.c |   9 +-
 4 files changed, 151 insertions(+), 8 deletions(-)
 create mode 100644 drivers/reset/reset-at91.c
drivers/reset/Kconfig +8 -0
index 4cb0ba0850..e4039d7474 100644
@@ -211,4 +211,12 @@ config RESET_DRA7
 	help
 	  Support for TI DRA7-RESET subsystem. Basic Assert/Deassert
 	  is supported.
+
+config RESET_AT91
+	bool "Enable support for Microchip/Atmel Reset Controller driver"
+	depends on DM_RESET && ARCH_AT91
+	help
+	  This enables the Reset Controller driver support for Microchip/Atmel
+	  SoCs. Mainly used to expose assert/deassert methods to other drivers
+	  that require it.
 endmenu
drivers/reset/Makefile +1 -0
index 0620b62809..6c8b45ecba 100644
@@ -31,3 +31,4 @@ obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o
 obj-$(CONFIG_RESET_SCMI) += reset-scmi.o
 obj-$(CONFIG_RESET_ZYNQMP) += reset-zynqmp.o
 obj-$(CONFIG_RESET_DRA7) += reset-dra7.o
+obj-$(CONFIG_RESET_AT91) += reset-at91.o
drivers/reset/reset-at91.c new file +141 -0

141 lines not on this page · raw message

drivers/sysreset/sysreset_at91.c +1 -8
index 24b87ee987..fc85f31ebf 100644
@@ -56,16 +56,9 @@ static struct sysreset_ops at91_sysreset = {
 	.request = at91_sysreset_request,
 };
 
-static const struct udevice_id a91_sysreset_ids[] = {
-	{ .compatible = "atmel,sama5d3-rstc" },
-	{ .compatible = "microchip,sam9x60-rstc" },
-	{ }
-};
-
 U_BOOT_DRIVER(sysreset_at91) = {
 	.id	= UCLASS_SYSRESET,
-	.name	= "at91_reset",
+	.name	= "at91_sysreset",
 	.ops	= &at91_sysreset,
 	.probe  = at91_sysreset_probe,
-	.of_match = a91_sysreset_ids,
 };
Signature · 1 line
2.34.1
#3 lore raw
In reply to Sergiu Moga
Quoted 14 lines · Sergiu Moga

This patch series originates from:
https://lists.denx.de/pipermail/u-boot/2022-December/502865.html

Implement a basic driver to enable assert/deassert operations.

v1 -> v2:
- rebase on u-boot next

Cristian Birsan (1):
ARM: at91: add sama7 SFR definitions

Sergiu Moga (1):
reset: at91: Add reset driver for basic assert/deassert operations

Quoted 9 lines
  arch/arm/mach-at91/include/mach/sama7-sfr.h |  59 ++++++++
  drivers/reset/Kconfig                       |   8 ++
  drivers/reset/Makefile                      |   1 +
  drivers/reset/reset-at91.c                  | 141 ++++++++++++++++++++
  drivers/sysreset/sysreset_at91.c            |   9 +-
  5 files changed, 210 insertions(+), 8 deletions(-)

create mode 100644 arch/arm/mach-at91/include/mach/sama7-sfr.h create mode 100644 drivers/reset/reset-at91.c

Applied series to u-boot-at91/next, thanks !