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: ardb+tianocore@kernel.org, quic_llindhol@quicinc.com,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: [edk2-devel] [PATCH 3/7] Platform/RaspberryPi: Add constants for controlling SPI
Date: Wed, 10 Jan 2024 18:04:06 -0600	[thread overview]
Message-ID: <20240111000412.2734985-4-jeremy.linton@arm.com> (raw)
In-Reply-To: <20240111000412.2734985-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>
---
 .../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.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113552): https://edk2.groups.io/g/devel/message/113552
Mute This Topic: https://groups.io/mt/103653088/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-01-11  0:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  0:04 [edk2-devel] [PATCH 0/7] RaspberryPi: SPI Variables, again Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 1/7] Platform/RaspberryPi: Move GPIO/SPI/I2C to SSDT Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 2/7] Platform/RaspberryPi: Add menu item to enable/disable GPIO Jeremy Linton
2024-01-11  0:04 ` Jeremy Linton [this message]
2024-01-11  0:04 ` [edk2-devel] [PATCH 4/7] Platform/RaspberryPi: Add mailbox cmd to control audio amp Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 5/7] Platform/RaspberryPi: Add SPI/GPIO to memory map Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 6/7] Platform/RaspberryPi: Allow pin function selection at runtime Jeremy Linton
2024-01-11  0:04 ` [edk2-devel] [PATCH 7/7] Platform/RaspberryPi: Add SPI flash variable store 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=20240111000412.2734985-4-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