Skip to content

Commit ee2b805

Browse files
Linus WalleijRussell King
authored andcommitted
ARM: 5678/1: SSP/SPI PL022 polarity terminology fix
The definition of the SPI clock phase for the Motorola mode of the PL022 driver was incorrect: the spec had been interpreted as data being recieved on rising or falling edge of the clocks while the correct interpretation is that data can be recieved on the first or second edge transition, falling or rising depending on the polarity setting. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent a2ca00e commit ee2b805

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎arch/arm/mach-u300/spi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct pl022_config_chip dummy_chip_info = {
4848
.data_size = SSP_DATA_BITS_8, /* used to be 12 in some default */
4949
.rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
5050
.tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
51-
.clk_phase = SSP_CLK_FALLING_EDGE,
51+
.clk_phase = SSP_CLK_SECOND_EDGE,
5252
.clk_pol = SSP_CLK_POL_IDLE_LOW,
5353
.ctrl_len = SSP_BITS_12,
5454
.wait_state = SSP_MWIRE_WAIT_ZERO,

‎drivers/spi/amba-pl022.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static void restore_state(struct pl022 *pl022)
534534
GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \
535535
GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \
536536
GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \
537-
GEN_MASK_BITS(SSP_CLK_FALLING_EDGE, SSP_CR0_MASK_SPH, 7) | \
537+
GEN_MASK_BITS(SSP_CLK_SECOND_EDGE, SSP_CR0_MASK_SPH, 7) | \
538538
GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \
539539
GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \
540540
GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \
@@ -1249,8 +1249,8 @@ static int verify_controller_parameters(struct pl022 *pl022,
12491249
return -EINVAL;
12501250
}
12511251
if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) {
1252-
if ((chip_info->clk_phase != SSP_CLK_RISING_EDGE)
1253-
&& (chip_info->clk_phase != SSP_CLK_FALLING_EDGE)) {
1252+
if ((chip_info->clk_phase != SSP_CLK_FIRST_EDGE)
1253+
&& (chip_info->clk_phase != SSP_CLK_SECOND_EDGE)) {
12541254
dev_err(chip_info->dev,
12551255
"Clock Phase is configured incorrectly\n");
12561256
return -EINVAL;
@@ -1487,7 +1487,7 @@ static int pl022_setup(struct spi_device *spi)
14871487
chip_info->data_size = SSP_DATA_BITS_12;
14881488
chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM;
14891489
chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC;
1490-
chip_info->clk_phase = SSP_CLK_FALLING_EDGE;
1490+
chip_info->clk_phase = SSP_CLK_SECOND_EDGE;
14911491
chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW;
14921492
chip_info->ctrl_len = SSP_BITS_8;
14931493
chip_info->wait_state = SSP_MWIRE_WAIT_ZERO;

‎include/linux/amba/pl022.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ enum ssp_tx_level_trig {
136136

137137
/**
138138
* enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139-
* @SSP_CLK_RISING_EDGE: Receive data on rising edge
140-
* @SSP_CLK_FALLING_EDGE: Receive data on falling edge
139+
* @SSP_CLK_FIRST_EDGE: Receive data on first edge transition (actual direction depends on polarity)
140+
* @SSP_CLK_SECOND_EDGE: Receive data on second edge transition (actual direction depends on polarity)
141141
*/
142142
enum ssp_spi_clk_phase {
143-
SSP_CLK_RISING_EDGE,
144-
SSP_CLK_FALLING_EDGE
143+
SSP_CLK_FIRST_EDGE,
144+
SSP_CLK_SECOND_EDGE
145145
};
146146

147147
/**

0 commit comments

Comments
 (0)