linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 02/36] mtd: st_spi_fsm: Supply all register address and bit logic defines
Date: Fri, 29 Nov 2013 12:18:51 +0000	[thread overview]
Message-ID: <1385727565-25794-3-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1385727565-25794-1-git-send-email-lee.jones@linaro.org>

Here we provide the FSM's register addresses, register bit names/offsets
and some commands which will prove useful as we start bulk the FMS's
driver out with functionality.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mtd/devices/st_spi_fsm.h | 164 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 164 insertions(+)

diff --git a/drivers/mtd/devices/st_spi_fsm.h b/drivers/mtd/devices/st_spi_fsm.h
index df45e1a..b420a43 100644
--- a/drivers/mtd/devices/st_spi_fsm.h
+++ b/drivers/mtd/devices/st_spi_fsm.h
@@ -16,6 +16,170 @@
 #ifndef ST_SPI_FSM_H
 #define ST_SPI_FSM_H
 
+/*
+ * FSM SPI Controller Registers
+ */
+#define SPI_CLOCKDIV			0x0010
+#define SPI_MODESELECT			0x0018
+#define SPI_CONFIGDATA			0x0020
+#define SPI_STA_MODE_CHANGE		0x0028
+#define SPI_FAST_SEQ_TRANSFER_SIZE	0x0100
+#define SPI_FAST_SEQ_ADD1		0x0104
+#define SPI_FAST_SEQ_ADD2		0x0108
+#define SPI_FAST_SEQ_ADD_CFG		0x010c
+#define SPI_FAST_SEQ_OPC1		0x0110
+#define SPI_FAST_SEQ_OPC2		0x0114
+#define SPI_FAST_SEQ_OPC3		0x0118
+#define SPI_FAST_SEQ_OPC4		0x011c
+#define SPI_FAST_SEQ_OPC5		0x0120
+#define SPI_MODE_BITS			0x0124
+#define SPI_DUMMY_BITS			0x0128
+#define SPI_FAST_SEQ_FLASH_STA_DATA	0x012c
+#define SPI_FAST_SEQ_1			0x0130
+#define SPI_FAST_SEQ_2			0x0134
+#define SPI_FAST_SEQ_3			0x0138
+#define SPI_FAST_SEQ_4			0x013c
+#define SPI_FAST_SEQ_CFG		0x0140
+#define SPI_FAST_SEQ_STA		0x0144
+#define SPI_QUAD_BOOT_SEQ_INIT_1	0x0148
+#define SPI_QUAD_BOOT_SEQ_INIT_2	0x014c
+#define SPI_QUAD_BOOT_READ_SEQ_1	0x0150
+#define SPI_QUAD_BOOT_READ_SEQ_2	0x0154
+#define SPI_PROGRAM_ERASE_TIME		0x0158
+#define SPI_MULT_PAGE_REPEAT_SEQ_1	0x015c
+#define SPI_MULT_PAGE_REPEAT_SEQ_2	0x0160
+#define SPI_STATUS_WR_TIME_REG		0x0164
+#define SPI_FAST_SEQ_DATA_REG		0x0300
+
+/*
+ * Register: SPI_MODESELECT
+ */
+#define SPI_MODESELECT_CONTIG		0x01
+#define SPI_MODESELECT_FASTREAD		0x02
+#define SPI_MODESELECT_DUALIO		0x04
+#define SPI_MODESELECT_FSM		0x08
+#define SPI_MODESELECT_QUADBOOT		0x10
+
+/*
+ * Register: SPI_CONFIGDATA
+ */
+#define SPI_CFG_DEVICE_ST		0x1
+#define SPI_CFG_DEVICE_ATMEL		0x4
+#define SPI_CFG_MIN_CS_HIGH(x)		(((x) & 0xfff) << 4)
+#define SPI_CFG_CS_SETUPHOLD(x)		(((x) & 0xff) << 16)
+#define SPI_CFG_DATA_HOLD(x)		(((x) & 0xff) << 24)
+
+/*
+ * Register: SPI_FAST_SEQ_TRANSFER_SIZE
+ */
+#define TRANSFER_SIZE(x)		((x) * 8)
+
+/*
+ * Register: SPI_FAST_SEQ_ADD_CFG
+ */
+#define ADR_CFG_CYCLES_ADD1(x)		((x) << 0)
+#define ADR_CFG_PADS_1_ADD1		(0x0 << 6)
+#define ADR_CFG_PADS_2_ADD1		(0x1 << 6)
+#define ADR_CFG_PADS_4_ADD1		(0x3 << 6)
+#define ADR_CFG_CSDEASSERT_ADD1		(1   << 8)
+#define ADR_CFG_CYCLES_ADD2(x)		((x) << (0+16))
+#define ADR_CFG_PADS_1_ADD2		(0x0 << (6+16))
+#define ADR_CFG_PADS_2_ADD2		(0x1 << (6+16))
+#define ADR_CFG_PADS_4_ADD2		(0x3 << (6+16))
+#define ADR_CFG_CSDEASSERT_ADD2		(1   << (8+16))
+
+/*
+ * Register: SPI_FAST_SEQ_n
+ */
+#define SEQ_OPC_OPCODE(x)		((x) << 0)
+#define SEQ_OPC_CYCLES(x)		((x) << 8)
+#define SEQ_OPC_PADS_1			(0x0 << 14)
+#define SEQ_OPC_PADS_2			(0x1 << 14)
+#define SEQ_OPC_PADS_4			(0x3 << 14)
+#define SEQ_OPC_CSDEASSERT		(1   << 16)
+
+/*
+ * Register: SPI_FAST_SEQ_CFG
+ */
+#define SEQ_CFG_STARTSEQ		(1 << 0)
+#define SEQ_CFG_SWRESET			(1 << 5)
+#define SEQ_CFG_CSDEASSERT		(1 << 6)
+#define SEQ_CFG_READNOTWRITE		(1 << 7)
+#define SEQ_CFG_ERASE			(1 << 8)
+#define SEQ_CFG_PADS_1			(0x0 << 16)
+#define SEQ_CFG_PADS_2			(0x1 << 16)
+#define SEQ_CFG_PADS_4			(0x3 << 16)
+
+/*
+ * Register: SPI_MODE_BITS
+ */
+#define MODE_DATA(x)			(x & 0xff)
+#define MODE_CYCLES(x)			((x & 0x3f) << 16)
+#define MODE_PADS_1			(0x0 << 22)
+#define MODE_PADS_2			(0x1 << 22)
+#define MODE_PADS_4			(0x3 << 22)
+#define DUMMY_CSDEASSERT		(1   << 24)
+
+/*
+ * Register: SPI_DUMMY_BITS
+ */
+#define DUMMY_CYCLES(x)			((x & 0x3f) << 16)
+#define DUMMY_PADS_1			(0x0 << 22)
+#define DUMMY_PADS_2			(0x1 << 22)
+#define DUMMY_PADS_4			(0x3 << 22)
+#define DUMMY_CSDEASSERT		(1   << 24)
+
+/*
+ * Register: SPI_FAST_SEQ_FLASH_STA_DATA
+ */
+#define STA_DATA_BYTE1(x)		((x & 0xff) << 0)
+#define STA_DATA_BYTE2(x)		((x & 0xff) << 8)
+#define STA_PADS_1			(0x0 << 16)
+#define STA_PADS_2			(0x1 << 16)
+#define STA_PADS_4			(0x3 << 16)
+#define STA_CSDEASSERT			(0x1 << 20)
+#define STA_RDNOTWR			(0x1 << 21)
+
+/*
+ * FSM SPI Instruction Opcodes
+ */
+#define STFSM_OPC_CMD			0x1
+#define STFSM_OPC_ADD			0x2
+#define STFSM_OPC_STA			0x3
+#define STFSM_OPC_MODE			0x4
+#define STFSM_OPC_DUMMY		0x5
+#define STFSM_OPC_DATA			0x6
+#define STFSM_OPC_WAIT			0x7
+#define STFSM_OPC_JUMP			0x8
+#define STFSM_OPC_GOTO			0x9
+#define STFSM_OPC_STOP			0xF
+
+/*
+ * FSM SPI Instructions (== opcode + operand).
+ */
+#define STFSM_INSTR(cmd, op)		((cmd) | ((op) << 4))
+
+#define STFSM_INST_CMD1			STFSM_INSTR(STFSM_OPC_CMD,	1)
+#define STFSM_INST_CMD2			STFSM_INSTR(STFSM_OPC_CMD,	2)
+#define STFSM_INST_CMD3			STFSM_INSTR(STFSM_OPC_CMD,	3)
+#define STFSM_INST_CMD4			STFSM_INSTR(STFSM_OPC_CMD,	4)
+#define STFSM_INST_CMD5			STFSM_INSTR(STFSM_OPC_CMD,	5)
+#define STFSM_INST_ADD1			STFSM_INSTR(STFSM_OPC_ADD,	1)
+#define STFSM_INST_ADD2			STFSM_INSTR(STFSM_OPC_ADD,	2)
+
+#define STFSM_INST_DATA_WRITE		STFSM_INSTR(STFSM_OPC_DATA,	1)
+#define STFSM_INST_DATA_READ		STFSM_INSTR(STFSM_OPC_DATA,	2)
+
+#define STFSM_INST_STA_RD1		STFSM_INSTR(STFSM_OPC_STA,	0x1)
+#define STFSM_INST_STA_WR1		STFSM_INSTR(STFSM_OPC_STA,	0x1)
+#define STFSM_INST_STA_RD2		STFSM_INSTR(STFSM_OPC_STA,	0x2)
+#define STFSM_INST_STA_WR1_2		STFSM_INSTR(STFSM_OPC_STA,	0x3)
+
+#define STFSM_INST_MODE			STFSM_INSTR(STFSM_OPC_MODE,	0)
+#define STFSM_INST_DUMMY		STFSM_INSTR(STFSM_OPC_DUMMY,	0)
+#define STFSM_INST_WAIT			STFSM_INSTR(STFSM_OPC_WAIT,	0)
+#define STFSM_INST_STOP			STFSM_INSTR(STFSM_OPC_STOP,	0)
+
 struct stfsm {
 	struct device		*dev;
 	void __iomem		*base;
-- 
1.8.3.2

  parent reply	other threads:[~2013-11-29 12:18 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 12:18 [PATCH v3 00/36] mtd: st_spi_fsm: Add new driver Lee Jones
2013-11-29 12:18 ` [PATCH v3 01/36] mtd: st_spi_fsm: Allocate resources and register with MTD framework Lee Jones
2013-12-02 13:52   ` srinivas kandagatla
2013-12-10 18:47   ` Brian Norris
2013-12-10 20:46   ` Brian Norris
2013-12-11  8:48     ` Lee Jones
2013-12-11  9:37       ` Angus Clark
2013-12-11 18:01         ` Brian Norris
2013-11-29 12:18 ` Lee Jones [this message]
2013-11-29 12:18 ` [PATCH v3 03/36] mtd: st_spi_fsm: Initialise and configure the FSM for normal working conditions Lee Jones
2013-12-10 19:01   ` Brian Norris
2013-12-10 20:08     ` Brian Norris
2013-11-29 12:18 ` [PATCH v3 04/36] mtd: st_spi_fsm: Supply framework for device requests Lee Jones
2013-12-10 20:19   ` Brian Norris
2013-12-13 14:35     ` Angus Clark
2013-11-29 12:18 ` [PATCH v3 05/36] mtd: st_spi_fsm: Supply a method to read from the FSM's FIFO Lee Jones
2013-11-29 12:18 ` [PATCH v3 06/36] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Lee Jones
2013-11-29 12:18 ` [PATCH v3 07/36] mtd: st_spi_fsm: Add support for JEDEC ID extraction Lee Jones
2013-11-29 12:18 ` [PATCH v3 08/36] mtd: devices: Provide header for shared OPCODEs and SFDP commands Lee Jones
2013-12-10 21:48   ` Brian Norris
2013-12-10 22:23     ` Brian Norris
2013-12-13 15:46       ` Angus Clark
2013-12-13 15:06     ` Angus Clark
2013-11-29 12:18 ` [PATCH v3 09/36] mtd: st_spi_fsm: Provide device look-up table Lee Jones
2013-12-10 22:03   ` Brian Norris
2013-12-17  9:17     ` Angus Clark
2014-01-07 16:11       ` Lee Jones
2013-11-29 12:18 ` [PATCH v3 10/36] mtd: st_spi_fsm: Dynamically setup flash device based on JEDEC ID Lee Jones
2013-11-29 12:19 ` [PATCH v3 11/36] mtd: st_spi_fsm: Search for preferred FSM message sequence configurations Lee Jones
2013-12-11  1:06   ` Brian Norris
2013-12-17  9:57     ` Angus Clark
2013-12-17 10:46       ` Lee Jones
2013-12-17 10:56         ` Angus Clark
2013-11-29 12:19 ` [PATCH v3 12/36] mtd: st_spi_fsm: Fetch platform specific configurations Lee Jones
2013-11-29 12:19 ` [PATCH v3 13/36] mtd: st_spi_fsm: Prepare the read/write FSM message sequence(s) Lee Jones
2013-11-29 12:19 ` [PATCH v3 14/36] mtd: st_spi_fsm: Add device-tree binding documentation Lee Jones
2013-11-29 19:07   ` Linus Walleij
2013-12-02 11:03     ` Lee Jones
2013-12-03 10:23       ` Linus Walleij
2013-12-03 11:31         ` Lee Jones
2013-12-03 12:22           ` Linus Walleij
2013-12-03 12:31             ` Lee Jones
2013-11-29 12:19 ` [PATCH v3 15/36] mtd: st_spi_fsm: Fetch boot-device from mode pins Lee Jones
2013-12-11  1:27   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 16/36] mtd: st_spi_fsm: Provide the erase one sector sequence Lee Jones
2013-11-29 12:19 ` [PATCH v3 17/36] mtd: st_spi_fsm: Provide the sequence for enabling 32bit addressing mode Lee Jones
2013-11-29 12:19 ` [PATCH v3 18/36] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Lee Jones
2013-11-29 12:19 ` [PATCH v3 19/36] mtd: st_spi_fsm: Add a check to if the chip can handle an SoC reset Lee Jones
2013-11-29 12:19 ` [PATCH v3 20/36] mtd: st_spi_fsm: Provide a method to put the chip into 32bit addressing mode Lee Jones
2013-12-11  1:49   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 21/36] mtd: st_spi_fsm: Update the flash Volatile Configuration Register Lee Jones
2013-11-29 12:19 ` [PATCH v3 22/36] mtd: st_spi_fsm: Provide the default read/write configurations Lee Jones
2013-12-11  1:37   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 23/36] mtd: st_spi_fsm: Supply the N25Qxxx specific read configurations Lee Jones
2013-11-29 12:19 ` [PATCH v3 24/36] mtd: st_spi_fsm: Supply the N25Qxxx chip specific configuration call-back Lee Jones
2013-12-11  2:33   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 25/36] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Lee Jones
2013-11-29 12:19 ` [PATCH v3 26/36] mtd: st_spi_fsm: Add the ability to read from a Serial Flash device Lee Jones
2013-12-11  2:09   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 27/36] mtd: st_spi_fsm: Write to Flash via the FSM FIFO Lee Jones
2013-11-29 12:19 ` [PATCH v3 28/36] mtd: st_spi_fsm: Supply a busy wait for post-write status Lee Jones
2013-12-11  2:13   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 29/36] mtd: st_spi_fsm: Add the ability to write to a Serial Flash device Lee Jones
2013-11-29 12:19 ` [PATCH v3 30/36] mtd: st_spi_fsm: Erase partly or as a whole " Lee Jones
2013-12-11  2:19   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 31/36] mtd: st_spi_fsm: Add the ability to read the FSM's status Lee Jones
2013-11-29 12:19 ` [PATCH v3 32/36] mtd: st_spi_fsm: Add the ability to write to FSM's status register Lee Jones
2013-11-29 12:19 ` [PATCH v3 33/36] mtd: st_spi_fsm: Supply the MX25xxx chip specific configuration call-back Lee Jones
2013-12-11  2:25   ` Brian Norris
2013-11-29 12:19 ` [PATCH v3 34/36] mtd: st_spi_fsm: Supply the S25FLxxx " Lee Jones
2013-11-29 12:19 ` [PATCH v3 35/36] mtd: st_spi_fsm: Supply the W25Qxxx " Lee Jones
2013-11-29 12:19 ` [PATCH v3 36/36] ARM: STi: Add support for the FSM Serial Flash Controller Lee Jones
2013-12-02 13:05   ` srinivas kandagatla
2013-12-02 13:20     ` Lee Jones
2013-12-02 13:26       ` srinivas kandagatla
2013-12-02 13:43         ` Lee Jones
2013-12-02 13:56           ` srinivas kandagatla

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=1385727565-25794-3-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).