The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: 1000001101000 <systemalerts@jeremypeper.com>
To: linux-kernel@vger.kernel.org, arnd@kernel.org
Cc: "Jeremy J . Peper" <jeremy@jeremypeper.com>
Subject: [PATCH 2/3] add code to enable XOR and CRYPTO engines on mv78xx0 devices enable XOR and CRYTO engines in ts-wxl
Date: Thu, 16 Mar 2023 18:40:08 -0500	[thread overview]
Message-ID: <20230316234009.2115005-2-user@earth> (raw)
In-Reply-To: <20230316234009.2115005-1-user@earth>

From: Jeremy J. Peper <jeremy@jeremypeper.com>

Signed-off-by: Jeremy J. Peper <jeremy@jeremypeper.com>
---
 arch/arm/mach-mv78xx0/buffalo-wxl-setup.c |  2 ++
 arch/arm/mach-mv78xx0/common.c            | 23 +++++++++++++++++++++++
 arch/arm/mach-mv78xx0/common.h            |  2 ++
 arch/arm/mach-mv78xx0/mv78xx0.h           | 10 ++++++++++
 4 files changed, 37 insertions(+)

diff --git a/arch/arm/mach-mv78xx0/buffalo-wxl-setup.c b/arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
index c3f6dc351..31359f586 100644
--- a/arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
+++ b/arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
@@ -119,6 +119,8 @@ static void __init wxl_init(void)
 	mv78xx0_uart1_init();
 	mv78xx0_uart2_init();
 	mv78xx0_uart3_init();
+	mv78xx0_xor_init();
+	mv78xx0_crypto_init();
 	mv78xx0_i2c_init();
 	i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
 }
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 461a68945..679753fcc 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -342,6 +342,29 @@ void __ref mv78xx0_timer_init(void)
 			IRQ_MV78XX0_TIMER_1, get_tclk());
 }
 
+/****************************************************************************
+ * XOR engine
+ ****************************************************************************/
+void __init mv78xx0_xor_init(void)
+{
+	orion_xor0_init(XOR_PHYS_BASE,
+		XOR_PHYS_BASE + 0x200,
+		IRQ_MV78XX0_XOR_0, IRQ_MV78XX0_XOR_1);
+}
+
+/****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+void __init mv78xx0_crypto_init(void)
+{
+	mvebu_mbus_add_window_by_id(MV78XX0_MBUS_SRAM_TARGET,
+				MV78XX0_MBUS_SRAM_ATTR,
+				MV78XX0_SRAM_PHYS_BASE,
+			MV78XX0_SRAM_SIZE);
+	orion_crypto_init(CRYPTO_PHYS_BASE, MV78XX0_SRAM_PHYS_BASE,
+		SZ_8K, IRQ_MV78XX0_CRYPTO);
+}
+
 
 /*****************************************************************************
  * General
diff --git a/arch/arm/mach-mv78xx0/common.h b/arch/arm/mach-mv78xx0/common.h
index d8c6c2400..9f1dfd595 100644
--- a/arch/arm/mach-mv78xx0/common.h
+++ b/arch/arm/mach-mv78xx0/common.h
@@ -43,6 +43,8 @@ void mv78xx0_uart0_init(void);
 void mv78xx0_uart1_init(void);
 void mv78xx0_uart2_init(void);
 void mv78xx0_uart3_init(void);
+void mv78xx0_xor_init(void);
+void mv78xx0_crypto_init(void);
 void mv78xx0_i2c_init(void);
 void mv78xx0_restart(enum reboot_mode, const char *);
 
diff --git a/arch/arm/mach-mv78xx0/mv78xx0.h b/arch/arm/mach-mv78xx0/mv78xx0.h
index 3f19bef7d..88efb1e44 100644
--- a/arch/arm/mach-mv78xx0/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/mv78xx0.h
@@ -49,9 +49,15 @@
 #define MV78XX0_REGS_VIRT_BASE		IOMEM(0xfec00000)
 #define MV78XX0_REGS_SIZE		SZ_1M
 
+#define MV78XX0_SRAM_PHYS_BASE          (0xf2200000)
+#define MV78XX0_SRAM_SIZE               SZ_8K
+
 #define MV78XX0_PCIE_MEM_PHYS_BASE	0xc0000000
 #define MV78XX0_PCIE_MEM_SIZE		0x30000000
 
+#define MV78XX0_MBUS_SRAM_TARGET       0x09
+#define MV78XX0_MBUS_SRAM_ATTR         0x00
+
 /*
  * Core-specific peripheral registers.
  */
@@ -98,6 +104,8 @@
 #define USB1_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0x51000)
 #define USB2_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0x52000)
 
+#define XOR_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0x60900)
+
 #define GE00_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0x70000)
 #define GE01_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0x74000)
 
@@ -106,6 +114,8 @@
 #define PCIE12_VIRT_BASE	(MV78XX0_REGS_VIRT_BASE + 0x88000)
 #define PCIE13_VIRT_BASE	(MV78XX0_REGS_VIRT_BASE + 0x8c000)
 
+#define CRYPTO_PHYS_BASE	(MV78XX0_REGS_PHYS_BASE + 0x90000)
+
 #define SATA_PHYS_BASE		(MV78XX0_REGS_PHYS_BASE + 0xa0000)
 
 /*
-- 
2.30.2


  reply	other threads:[~2023-03-16 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 23:40 [PATCH 1/3] set the correct driver for the i2c RTC 1000001101000
2023-03-16 23:40 ` 1000001101000 [this message]
2023-03-16 23:40 ` [PATCH 3/3] fix entries for gpios, buttons and usb ports 1000001101000
2023-03-17  7:33 ` [PATCH 1/3] set the correct driver for the i2c RTC Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230316234009.2115005-2-user@earth \
    --to=systemalerts@jeremypeper.com \
    --cc=arnd@kernel.org \
    --cc=jeremy@jeremypeper.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox