Realtek switch SoC docs

longan register: SPI_CTRL1

Details

Name
SPI_CTRL1
Offset
03a0
Feature
INTERFACE

Description

SPI Controller register (1)

default: 0x0034_0000

Fields

Name LSB Bits Description
RESERVED 29 3
DATA_WIDTH 20 9

SPI Command read/write data width

Note, val + 1, e.g. 0x000 = 1 byte, max is 512 bytes.

ADDR_WIDTH 17 3

External SPI slave address width

  • 0x0: 1 byte
  • 0x1: 2 byte
  • 0x2: 3 byte
  • 0x3: 4 byte
  • 0x4: None
  • 0x5 - 0xf: reserved
SPI_CLK_DIV 14 3

SPI Clock divider

@400 MHz System Clock

  • 0x0: /6
  • 0x1: /8
  • 0x2: /10
  • 0x3: /16
  • 0x4: /32
  • 0x5: /200
  • 0x6: /320
  • 0x7: /400

@150 MHz System Clock

  • 0x0: /4
  • 0x1: /6
  • 0x2: /8
  • 0x3: /16
  • 0x4: /32
  • 0x5: /80
  • 0x6: /120
  • 0x7: /150
GPIO_SPI_SEL 13 1

GPIO SPI Select

  • 0x0: GPIO3, GPIO4, GPIO5 are GPIO
  • 0x1: GPIO3 = SCK, GPIO4 = MISO, GPIO5 = MOSI
CSB_OUT_SEL 12 1

Chip select choice

Note, depends on GPIO6/GPIO7 setting

  • 0b0: CS#0
  • 0b1: CS#1
GPIO6_CSB1_SEL 11 1

GPIO6 Chip select choice

  • 0x0: GPIO
  • 0x1: CS#1
GPIO7_CSB0_SEL 10 1

GPIO7 Chip select choice

  • 0x0: GPIO
  • 0x1: CS#0
SPI_CMD 2 8

SPI command

SPI_CMD_TYPE 1 1

SPI Read or Write selector

  • 0b0: read
  • 0b1: write
SPI_TRIG 0 1

SPI execute command

  • 0b0: noop
  • 0b1: execute, auto-clears on completion