public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com,
	awarkentin@vmware.com, Sunny.Wang@arm.com,
	samer.el-haj-mahmoud@arm.com, mariobalanica02@gmail.com,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH 5/9] Platform/RaspberryPi: Add constants for controlling SPI
Date: Thu,  2 Dec 2021 10:52:02 -0600	[thread overview]
Message-ID: <20211202165206.79615-6-jeremy.linton@arm.com> (raw)
In-Reply-To: <20211202165206.79615-1-jeremy.linton@arm.com>

Add the #defines needed to access the SPI interface
documented in the BCM2711 Peripheral guide chapter 8.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 .../Bcm283x/Include/IndustryStandard/Bcm2836.h     | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
index a930c64af3..55a446a86c 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -109,6 +109,40 @@
 #define BCM2836_SPI2_LENGTH                                 0x00000040
 #define BCM2836_SPI2_BASE_ADDRESS                           (BCM2836_SOC_REGISTERS + BCM2836_SPI2_OFFSET)
 
+/* SPI register offsets */
+#define BCM2835_SPI_CS                                      0x00
+#define BCM2835_SPI_FIFO                                    0x04
+#define BCM2835_SPI_CLK                                     0x08
+#define BCM2835_SPI_DLEN                                    0x0c
+#define BCM2835_SPI_LTOH                                    0x10
+#define BCM2835_SPI_DC                                      0x14
+
+/* Bitfields in CS */
+#define BCM2835_SPI_CS_LEN_LONG                             0x02000000
+#define BCM2835_SPI_CS_DMA_LEN                              0x01000000
+#define BCM2835_SPI_CS_CSPOL2                               0x00800000
+#define BCM2835_SPI_CS_CSPOL1                               0x00400000
+#define BCM2835_SPI_CS_CSPOL0                               0x00200000
+#define BCM2835_SPI_CS_RXF                                  0x00100000
+#define BCM2835_SPI_CS_RXR                                  0x00080000
+#define BCM2835_SPI_CS_TXD                                  0x00040000
+#define BCM2835_SPI_CS_RXD                                  0x00020000
+#define BCM2835_SPI_CS_DONE                                 0x00010000
+#define BCM2835_SPI_CS_LEN                                  0x00002000
+#define BCM2835_SPI_CS_REN                                  0x00001000
+#define BCM2835_SPI_CS_ADCS                                 0x00000800
+#define BCM2835_SPI_CS_INTR                                 0x00000400
+#define BCM2835_SPI_CS_INTD                                 0x00000200
+#define BCM2835_SPI_CS_DMAEN                                0x00000100
+#define BCM2835_SPI_CS_TA                                   0x00000080
+#define BCM2835_SPI_CS_CSPOL                                0x00000040
+#define BCM2835_SPI_CS_CLEAR_RX                             0x00000020
+#define BCM2835_SPI_CS_CLEAR_TX                             0x00000010
+#define BCM2835_SPI_CS_CPOL                                 0x00000008
+#define BCM2835_SPI_CS_CPHA                                 0x00000004
+#define BCM2835_SPI_CS_CS_10                                0x00000002
+#define BCM2835_SPI_CS_CS_01                                0x00000001
+
 /* dma constants */
 #define BCM2836_DMA0_OFFSET                                 0x00007000
 #define BCM2836_DMA0_BASE_ADDRESS                           (BCM2836_SOC_REGISTERS + BCM2836_DMA0_OFFSET)
-- 
2.13.7


  parent reply	other threads:[~2021-12-02 16:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 16:51 [PATCH 0/9] Platform/RaspberryPi: Utilize SPI flash for EFI variables Jeremy Linton
2021-12-02 16:51 ` [PATCH 1/9] Platform/RaspberryPi: Cleanup menu visibility Jeremy Linton
2021-12-02 16:51 ` [PATCH 2/9] Platform/RaspberryPi: Give the user control over the XHCI mailbox Jeremy Linton
2021-12-02 16:52 ` [PATCH 3/9] Platform/RaspberryPi: Move GPIO/SPI/I2C to SSDT Jeremy Linton
2021-12-02 16:52 ` [PATCH 4/9] Platform/RaspberryPi: Add menu item to enable/disable GPIO Jeremy Linton
2021-12-02 16:52 ` Jeremy Linton [this message]
2021-12-02 16:52 ` [PATCH 6/9] Platform/RaspberryPi: Add mailbox cmd to control audio amp Jeremy Linton
2021-12-02 16:52 ` [PATCH 7/9] Platform/RaspberryPi: Add SPI/GPIO to memory map Jeremy Linton
2021-12-02 16:52 ` [PATCH 8/9] Platform/RaspberryPi: Allow pin function selection at runtime Jeremy Linton
2021-12-02 17:03 ` [edk2-devel] [PATCH 0/9] Platform/RaspberryPi: Utilize SPI flash for EFI variables Ard Biesheuvel
2021-12-02 17:09   ` Ard Biesheuvel
2021-12-02 17:29     ` Jeremy Linton
2021-12-02 17:55     ` Jeremy Linton
2021-12-03 18:12       ` Ard Biesheuvel
2021-12-03 19:31         ` Jeremy Linton

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-list 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=20211202165206.79615-6-jeremy.linton@arm.com \
    --to=devel@edk2.groups.io \
    /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