Skip to content

Commit 70ada77

Browse files
committed
Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6: (53 commits) spi/omap2_mcspi: Verify TX reg is empty after TX only xfer with DMA spi/omap2_mcspi: disable channel after TX_ONLY transfer in PIO mode spi/bfin_spi: namespace local structs spi/bfin_spi: init early spi/bfin_spi: check per-transfer bits_per_word spi/bfin_spi: warn when CS is driven by hardware (CPHA=0) spi/bfin_spi: cs should be always low when a new transfer begins spi/bfin_spi: fix typo in comment spi/bfin_spi: reject unsupported SPI modes spi/bfin_spi: use dma_disable_irq_nosync() in irq handler spi/bfin_spi: combine duplicate SPI_CTL read/write logic spi/bfin_spi: reset ctl_reg bits when setup is run again on a device spi/bfin_spi: push all size checks into the transfer function spi/bfin_spi: use nosync when disabling the IRQ from the IRQ handler spi/bfin_spi: sync hardware state before reprogramming everything spi/bfin_spi: save/restore state when suspending/resuming spi/bfin_spi: redo GPIO CS handling Blackfin: SPI: expand SPI bitmasks spi/bfin_spi: use the SPI namespaced bit names spi/bfin_spi: drop extra memory we don't need ...
2 parents b22793f + 2764c50 commit 70ada77

File tree

24 files changed

+3842
-1232
lines changed

24 files changed

+3842
-1232
lines changed

Documentation/powerpc/dts-bindings/fsl/spi.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
* SPI (Serial Peripheral Interface)
22

33
Required properties:
4-
- cell-index : SPI controller index.
4+
- cell-index : QE SPI subblock index.
5+
0: QE subblock SPI1
6+
1: QE subblock SPI2
57
- compatible : should be "fsl,spi".
68
- mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
79
- reg : Offset and length of the register set for the device
@@ -29,3 +31,23 @@ Example:
2931
gpios = <&gpio 18 1 // device reg=<0>
3032
&gpio 19 1>; // device reg=<1>
3133
};
34+
35+
36+
* eSPI (Enhanced Serial Peripheral Interface)
37+
38+
Required properties:
39+
- compatible : should be "fsl,mpc8536-espi".
40+
- reg : Offset and length of the register set for the device.
41+
- interrupts : should contain eSPI interrupt, the device has one interrupt.
42+
- fsl,espi-num-chipselects : the number of the chipselect signals.
43+
44+
Example:
45+
spi@110000 {
46+
#address-cells = <1>;
47+
#size-cells = <0>;
48+
compatible = "fsl,mpc8536-espi";
49+
reg = <0x110000 0x1000>;
50+
interrupts = <53 0x2>;
51+
interrupt-parent = <&mpic>;
52+
fsl,espi-num-chipselects = <4>;
53+
};

arch/arm/mach-lpc32xx/phy3250.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,12 @@ static void phy3250_spi_cs_set(u32 control)
172172
}
173173

174174
static struct pl022_config_chip spi0_chip_info = {
175-
.lbm = LOOPBACK_DISABLED,
176175
.com_mode = INTERRUPT_TRANSFER,
177176
.iface = SSP_INTERFACE_MOTOROLA_SPI,
178177
.hierarchy = SSP_MASTER,
179178
.slave_tx_disable = 0,
180-
.endian_tx = SSP_TX_LSB,
181-
.endian_rx = SSP_RX_LSB,
182-
.data_size = SSP_DATA_BITS_8,
183179
.rx_lev_trig = SSP_RX_4_OR_MORE_ELEM,
184180
.tx_lev_trig = SSP_TX_4_OR_MORE_EMPTY_LOC,
185-
.clk_phase = SSP_CLK_FIRST_EDGE,
186-
.clk_pol = SSP_CLK_POL_IDLE_LOW,
187181
.ctrl_len = SSP_BITS_8,
188182
.wait_state = SSP_MWIRE_WAIT_ZERO,
189183
.duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
@@ -239,6 +233,7 @@ static int __init phy3250_spi_board_register(void)
239233
.max_speed_hz = 5000000,
240234
.bus_num = 0,
241235
.chip_select = 0,
236+
.mode = SPI_MODE_0,
242237
.platform_data = &eeprom,
243238
.controller_data = &spi0_chip_info,
244239
},

arch/arm/mach-u300/dummyspichip.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static ssize_t dummy_looptest(struct device *dev,
4646
* struct, this is just used here to alter the behaviour of the chip
4747
* in order to perform tests.
4848
*/
49-
struct pl022_config_chip *chip_info = spi->controller_data;
5049
int status;
5150
u8 txbuf[14] = {0xDE, 0xAD, 0xBE, 0xEF, 0x2B, 0xAD,
5251
0xCA, 0xFE, 0xBA, 0xBE, 0xB1, 0x05,
@@ -72,7 +71,7 @@ static ssize_t dummy_looptest(struct device *dev,
7271
* Force chip to 8 bit mode
7372
* WARNING: NEVER DO THIS IN REAL DRIVER CODE, THIS SHOULD BE STATIC!
7473
*/
75-
chip_info->data_size = SSP_DATA_BITS_8;
74+
spi->bits_per_word = 8;
7675
/* You should NOT DO THIS EITHER */
7776
spi->master->setup(spi);
7877

@@ -159,7 +158,7 @@ static ssize_t dummy_looptest(struct device *dev,
159158
* Force chip to 16 bit mode
160159
* WARNING: NEVER DO THIS IN REAL DRIVER CODE, THIS SHOULD BE STATIC!
161160
*/
162-
chip_info->data_size = SSP_DATA_BITS_16;
161+
spi->bits_per_word = 16;
163162
/* You should NOT DO THIS EITHER */
164163
spi->master->setup(spi);
165164

arch/arm/mach-u300/spi.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ static void select_dummy_chip(u32 chipselect)
3030
}
3131

3232
struct pl022_config_chip dummy_chip_info = {
33-
/* Nominally this is LOOPBACK_DISABLED, but this is our dummy chip! */
34-
.lbm = LOOPBACK_ENABLED,
3533
/*
3634
* available POLLING_TRANSFER and INTERRUPT_TRANSFER,
3735
* DMA_TRANSFER does not work
@@ -42,14 +40,8 @@ struct pl022_config_chip dummy_chip_info = {
4240
.hierarchy = SSP_MASTER,
4341
/* 0 = drive TX even as slave, 1 = do not drive TX as slave */
4442
.slave_tx_disable = 0,
45-
/* LSB first */
46-
.endian_tx = SSP_TX_LSB,
47-
.endian_rx = SSP_RX_LSB,
48-
.data_size = SSP_DATA_BITS_8, /* used to be 12 in some default */
4943
.rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
5044
.tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
51-
.clk_phase = SSP_CLK_SECOND_EDGE,
52-
.clk_pol = SSP_CLK_POL_IDLE_LOW,
5345
.ctrl_len = SSP_BITS_12,
5446
.wait_state = SSP_MWIRE_WAIT_ZERO,
5547
.duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
@@ -75,7 +67,7 @@ static struct spi_board_info u300_spi_devices[] = {
7567
.bus_num = 0, /* Only one bus on this chip */
7668
.chip_select = 0,
7769
/* Means SPI_CS_HIGH, change if e.g low CS */
78-
.mode = 0,
70+
.mode = SPI_MODE_1 | SPI_LSB_FIRST | SPI_LOOP,
7971
},
8072
#endif
8173
};

arch/arm/mach-ux500/board-mop500.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,13 @@ static void ab4500_spi_cs_control(u32 command)
5555
}
5656

5757
struct pl022_config_chip ab4500_chip_info = {
58-
.lbm = LOOPBACK_DISABLED,
5958
.com_mode = INTERRUPT_TRANSFER,
6059
.iface = SSP_INTERFACE_MOTOROLA_SPI,
6160
/* we can act as master only */
6261
.hierarchy = SSP_MASTER,
6362
.slave_tx_disable = 0,
64-
.endian_rx = SSP_RX_MSB,
65-
.endian_tx = SSP_TX_MSB,
66-
.data_size = SSP_DATA_BITS_24,
6763
.rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
6864
.tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
69-
.clk_phase = SSP_CLK_SECOND_EDGE,
70-
.clk_pol = SSP_CLK_POL_IDLE_HIGH,
7165
.cs_control = ab4500_spi_cs_control,
7266
};
7367

@@ -83,7 +77,7 @@ static struct spi_board_info u8500_spi_devices[] = {
8377
.max_speed_hz = 12000000,
8478
.bus_num = 0,
8579
.chip_select = 0,
86-
.mode = SPI_MODE_0,
80+
.mode = SPI_MODE_3,
8781
.irq = IRQ_DB8500_AB8500,
8882
},
8983
};

arch/arm/plat-samsung/include/plat/s3c64xx-spi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct s3c64xx_spi_csinfo {
3232
* struct s3c64xx_spi_info - SPI Controller defining structure
3333
* @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
3434
* @src_clk_name: Platform name of the corresponding clock.
35+
* @clk_from_cmu: If the SPI clock/prescalar control block is present
36+
* by the platform's clock-management-unit and not in SPI controller.
3537
* @num_cs: Number of CS this controller emulates.
3638
* @cfg_gpio: Configure pins for this SPI controller.
3739
* @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
@@ -41,6 +43,7 @@ struct s3c64xx_spi_csinfo {
4143
struct s3c64xx_spi_info {
4244
int src_clk_nr;
4345
char *src_clk_name;
46+
bool clk_from_cmu;
4447

4548
int num_cs;
4649

arch/blackfin/include/asm/bfin5xx_spi.h

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,17 @@
1111

1212
#define MIN_SPI_BAUD_VAL 2
1313

14-
#define SPI_READ 0
15-
#define SPI_WRITE 1
16-
17-
#define SPI_CTRL_OFF 0x0
18-
#define SPI_FLAG_OFF 0x4
19-
#define SPI_STAT_OFF 0x8
20-
#define SPI_TXBUFF_OFF 0xc
21-
#define SPI_RXBUFF_OFF 0x10
22-
#define SPI_BAUD_OFF 0x14
23-
#define SPI_SHAW_OFF 0x18
24-
25-
2614
#define BIT_CTL_ENABLE 0x4000
2715
#define BIT_CTL_OPENDRAIN 0x2000
2816
#define BIT_CTL_MASTER 0x1000
29-
#define BIT_CTL_POLAR 0x0800
30-
#define BIT_CTL_PHASE 0x0400
31-
#define BIT_CTL_BITORDER 0x0200
17+
#define BIT_CTL_CPOL 0x0800
18+
#define BIT_CTL_CPHA 0x0400
19+
#define BIT_CTL_LSBF 0x0200
3220
#define BIT_CTL_WORDSIZE 0x0100
33-
#define BIT_CTL_MISOENABLE 0x0020
21+
#define BIT_CTL_EMISO 0x0020
22+
#define BIT_CTL_PSSE 0x0010
23+
#define BIT_CTL_GM 0x0008
24+
#define BIT_CTL_SZ 0x0004
3425
#define BIT_CTL_RXMOD 0x0000
3526
#define BIT_CTL_TXMOD 0x0001
3627
#define BIT_CTL_TIMOD_DMA_TX 0x0003
@@ -50,61 +41,7 @@
5041
#define BIT_STU_SENDOVER 0x0001
5142
#define BIT_STU_RECVFULL 0x0020
5243

53-
#define CFG_SPI_ENABLE 1
54-
#define CFG_SPI_DISABLE 0
55-
56-
#define CFG_SPI_OUTENABLE 1
57-
#define CFG_SPI_OUTDISABLE 0
58-
59-
#define CFG_SPI_ACTLOW 1
60-
#define CFG_SPI_ACTHIGH 0
61-
62-
#define CFG_SPI_PHASESTART 1
63-
#define CFG_SPI_PHASEMID 0
64-
65-
#define CFG_SPI_MASTER 1
66-
#define CFG_SPI_SLAVE 0
67-
68-
#define CFG_SPI_SENELAST 0
69-
#define CFG_SPI_SENDZERO 1
70-
71-
#define CFG_SPI_RCVFLUSH 1
72-
#define CFG_SPI_RCVDISCARD 0
73-
74-
#define CFG_SPI_LSBFIRST 1
75-
#define CFG_SPI_MSBFIRST 0
76-
77-
#define CFG_SPI_WORDSIZE16 1
78-
#define CFG_SPI_WORDSIZE8 0
79-
80-
#define CFG_SPI_MISOENABLE 1
81-
#define CFG_SPI_MISODISABLE 0
82-
83-
#define CFG_SPI_READ 0x00
84-
#define CFG_SPI_WRITE 0x01
85-
#define CFG_SPI_DMAREAD 0x02
86-
#define CFG_SPI_DMAWRITE 0x03
87-
88-
#define CFG_SPI_CSCLEARALL 0
89-
#define CFG_SPI_CHIPSEL1 1
90-
#define CFG_SPI_CHIPSEL2 2
91-
#define CFG_SPI_CHIPSEL3 3
92-
#define CFG_SPI_CHIPSEL4 4
93-
#define CFG_SPI_CHIPSEL5 5
94-
#define CFG_SPI_CHIPSEL6 6
95-
#define CFG_SPI_CHIPSEL7 7
96-
97-
#define CFG_SPI_CS1VALUE 1
98-
#define CFG_SPI_CS2VALUE 2
99-
#define CFG_SPI_CS3VALUE 3
100-
#define CFG_SPI_CS4VALUE 4
101-
#define CFG_SPI_CS5VALUE 5
102-
#define CFG_SPI_CS6VALUE 6
103-
#define CFG_SPI_CS7VALUE 7
104-
105-
#define CMD_SPI_SET_BAUDRATE 2
106-
#define CMD_SPI_GET_SYSTEMCLOCK 25
107-
#define CMD_SPI_SET_WRITECONTINUOUS 26
44+
#define MAX_CTRL_CS 8 /* cs in spi controller */
10845

10946
/* device.platform_data for SSP controller devices */
11047
struct bfin5xx_spi_master {
@@ -120,9 +57,7 @@ struct bfin5xx_spi_chip {
12057
u16 ctl_reg;
12158
u8 enable_dma;
12259
u8 bits_per_word;
123-
u8 cs_change_per_word;
12460
u16 cs_chg_udelay; /* Some devices require 16-bit delays */
125-
u32 cs_gpio;
12661
/* Value to send if no TX value is supplied, usually 0x0 or 0xFFFF */
12762
u16 idle_tx_val;
12863
u8 pio_interrupt; /* Enable spi data irq */

arch/powerpc/boot/dts/mpc8536ds.dts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,58 @@
108108
};
109109
};
110110

111+
spi@7000 {
112+
#address-cells = <1>;
113+
#size-cells = <0>;
114+
compatible = "fsl,mpc8536-espi";
115+
reg = <0x7000 0x1000>;
116+
interrupts = <59 0x2>;
117+
interrupt-parent = <&mpic>;
118+
fsl,espi-num-chipselects = <4>;
119+
120+
flash@0 {
121+
#address-cells = <1>;
122+
#size-cells = <1>;
123+
compatible = "spansion,s25sl12801";
124+
reg = <0>;
125+
spi-max-frequency = <40000000>;
126+
partition@u-boot {
127+
label = "u-boot";
128+
reg = <0x00000000 0x00100000>;
129+
read-only;
130+
};
131+
partition@kernel {
132+
label = "kernel";
133+
reg = <0x00100000 0x00500000>;
134+
read-only;
135+
};
136+
partition@dtb {
137+
label = "dtb";
138+
reg = <0x00600000 0x00100000>;
139+
read-only;
140+
};
141+
partition@fs {
142+
label = "file system";
143+
reg = <0x00700000 0x00900000>;
144+
};
145+
};
146+
flash@1 {
147+
compatible = "spansion,s25sl12801";
148+
reg = <1>;
149+
spi-max-frequency = <40000000>;
150+
};
151+
flash@2 {
152+
compatible = "spansion,s25sl12801";
153+
reg = <2>;
154+
spi-max-frequency = <40000000>;
155+
};
156+
flash@3 {
157+
compatible = "spansion,s25sl12801";
158+
reg = <3>;
159+
spi-max-frequency = <40000000>;
160+
};
161+
};
162+
111163
dma@21300 {
112164
#address-cells = <1>;
113165
#size-cells = <1>;

arch/powerpc/boot/dts/p4080ds.dts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,19 @@
236236
};
237237

238238
spi@110000 {
239-
cell-index = <0>;
240239
#address-cells = <1>;
241240
#size-cells = <0>;
242-
compatible = "fsl,espi";
241+
compatible = "fsl,p4080-espi", "fsl,mpc8536-espi";
243242
reg = <0x110000 0x1000>;
244243
interrupts = <53 0x2>;
245244
interrupt-parent = <&mpic>;
246-
espi,num-ss-bits = <4>;
247-
mode = "cpu";
245+
fsl,espi-num-chipselects = <4>;
248246

249-
fsl_m25p80@0 {
247+
flash@0 {
250248
#address-cells = <1>;
251249
#size-cells = <1>;
252-
compatible = "fsl,espi-flash";
250+
compatible = "spansion,s25sl12801";
253251
reg = <0>;
254-
linux,modalias = "fsl_m25p80";
255252
spi-max-frequency = <40000000>; /* input clock */
256253
partition@u-boot {
257254
label = "u-boot";

drivers/mfd/ab8500-spi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ static int __devinit ab8500_spi_probe(struct spi_device *spi)
8383
struct ab8500 *ab8500;
8484
int ret;
8585

86+
spi->bits_per_word = 24;
87+
ret = spi_setup(spi);
88+
if (ret < 0)
89+
return ret;
90+
8691
ab8500 = kzalloc(sizeof *ab8500, GFP_KERNEL);
8792
if (!ab8500)
8893
return -ENOMEM;

0 commit comments

Comments
 (0)