Blame view

drivers/spi/spi-fsl-spi.h 1.84 KB
2874c5fd2   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
e8beacbb8   Andreas Larsson   spi/spi-fsl-spi: ...
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   * Freescale SPI controller driver.
   *
   * Maintainer: Kumar Gala
   *
   * Copyright (C) 2006 Polycom, Inc.
   * Copyright 2010 Freescale Semiconductor, Inc.
   *
   * CPM SPI and QE buffer descriptors mode support:
   * Copyright (c) 2009  MontaVista Software, Inc.
   * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
   *
447b0c7b9   Andreas Larsson   spi/spi-fsl-spi: ...
14
15
16
   * GRLIB support:
   * Copyright (c) 2012 Aeroflex Gaisler AB.
   * Author: Andreas Larsson <andreas@gaisler.com>
e8beacbb8   Andreas Larsson   spi/spi-fsl-spi: ...
17
18
19
20
21
22
23
   */
  
  #ifndef __SPI_FSL_SPI_H__
  #define __SPI_FSL_SPI_H__
  
  /* SPI Controller registers */
  struct fsl_spi_reg {
447b0c7b9   Andreas Larsson   spi/spi-fsl-spi: ...
24
25
  	__be32 cap; /* TYPE_GRLIB specific */
  	u8 res1[0x1C];
e8beacbb8   Andreas Larsson   spi/spi-fsl-spi: ...
26
27
28
29
30
31
  	__be32 mode;
  	__be32 event;
  	__be32 mask;
  	__be32 command;
  	__be32 transmit;
  	__be32 receive;
447b0c7b9   Andreas Larsson   spi/spi-fsl-spi: ...
32
  	__be32 slvsel; /* TYPE_GRLIB specific */
e8beacbb8   Andreas Larsson   spi/spi-fsl-spi: ...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  };
  
  /* SPI Controller mode register definitions */
  #define	SPMODE_LOOP		(1 << 30)
  #define	SPMODE_CI_INACTIVEHIGH	(1 << 29)
  #define	SPMODE_CP_BEGIN_EDGECLK	(1 << 28)
  #define	SPMODE_DIV16		(1 << 27)
  #define	SPMODE_REV		(1 << 26)
  #define	SPMODE_MS		(1 << 25)
  #define	SPMODE_ENABLE		(1 << 24)
  #define	SPMODE_LEN(x)		((x) << 20)
  #define	SPMODE_PM(x)		((x) << 16)
  #define	SPMODE_OP		(1 << 14)
  #define	SPMODE_CG(x)		((x) << 7)
447b0c7b9   Andreas Larsson   spi/spi-fsl-spi: ...
47
48
49
50
  /* TYPE_GRLIB SPI Controller capability register definitions */
  #define SPCAP_SSEN(x)		(((x) >> 16) & 0x1)
  #define SPCAP_SSSZ(x)		(((x) >> 24) & 0xff)
  #define SPCAP_MAXWLEN(x)	(((x) >> 20) & 0xf)
e8beacbb8   Andreas Larsson   spi/spi-fsl-spi: ...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  /*
   * Default for SPI Mode:
   *	SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk
   */
  #define	SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \
  			 SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf))
  
  /* SPIE register values */
  #define	SPIE_NE		0x00000200	/* Not empty */
  #define	SPIE_NF		0x00000100	/* Not full */
  
  /* SPIM register values */
  #define	SPIM_NE		0x00000200	/* Not empty */
  #define	SPIM_NF		0x00000100	/* Not full */
  
  #endif /* __SPI_FSL_SPI_H__ */