summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common/spi.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-12-02 22:03:27 -0800
committerPatrick Georgi <pgeorgi@google.com>2019-12-04 14:11:17 +0000
commit55009af42c39f413c49503670ce9bc2858974962 (patch)
tree099e9728bfe8066999de4d7a30021eb10bd71d12 /src/soc/mediatek/common/spi.c
parent1c371572188a90ea16275460dd4ab6bf9966350b (diff)
Change all clrsetbits_leXX() to clrsetbitsXX()
This patch changes all existing instances of clrsetbits_leXX() to the new endian-independent clrsetbitsXX(), after double-checking that they're all in SoC-specific code operating on CPU registers and not actually trying to make an endian conversion. This patch was created by running sed -i -e 's/\([cs][le][rt]bits\)_le\([136][624]\)/\1\2/g' across the codebase and cleaning up formatting a bit. Change-Id: I7fc3e736e5fe927da8960fdcd2aae607b62b5ff4 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37433 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/soc/mediatek/common/spi.c')
-rw-r--r--src/soc/mediatek/common/spi.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/soc/mediatek/common/spi.c b/src/soc/mediatek/common/spi.c
index 2a668fe349..9271d6e6dc 100644
--- a/src/soc/mediatek/common/spi.c
+++ b/src/soc/mediatek/common/spi.c
@@ -50,8 +50,8 @@ static inline struct mtk_spi_bus *to_mtk_spi(const struct spi_slave *slave)
static void spi_sw_reset(struct mtk_spi_regs *regs)
{
- setbits_le32(&regs->spi_cmd_reg, SPI_CMD_RST_EN);
- clrbits_le32(&regs->spi_cmd_reg, SPI_CMD_RST_EN);
+ setbits32(&regs->spi_cmd_reg, SPI_CMD_RST_EN);
+ clrbits32(&regs->spi_cmd_reg, SPI_CMD_RST_EN);
}
void mtk_spi_init(unsigned int bus, enum spi_pad_mask pad_select,
@@ -77,17 +77,17 @@ void mtk_spi_init(unsigned int bus, enum spi_pad_mask pad_select,
mtk_spi_set_timing(regs, sck_ticks, cs_ticks, tick_dly);
- clrsetbits_le32(&regs->spi_cmd_reg,
- (SPI_CMD_CPHA_EN | SPI_CMD_CPOL_EN |
- SPI_CMD_TX_ENDIAN_EN | SPI_CMD_RX_ENDIAN_EN |
- SPI_CMD_TX_DMA_EN | SPI_CMD_RX_DMA_EN |
- SPI_CMD_PAUSE_EN | SPI_CMD_DEASSERT_EN),
- (SPI_CMD_TXMSBF_EN | SPI_CMD_RXMSBF_EN |
- SPI_CMD_FINISH_IE_EN | SPI_CMD_PAUSE_IE_EN));
+ clrsetbits32(&regs->spi_cmd_reg,
+ (SPI_CMD_CPHA_EN | SPI_CMD_CPOL_EN |
+ SPI_CMD_TX_ENDIAN_EN | SPI_CMD_RX_ENDIAN_EN |
+ SPI_CMD_TX_DMA_EN | SPI_CMD_RX_DMA_EN |
+ SPI_CMD_PAUSE_EN | SPI_CMD_DEASSERT_EN),
+ (SPI_CMD_TXMSBF_EN | SPI_CMD_RXMSBF_EN |
+ SPI_CMD_FINISH_IE_EN | SPI_CMD_PAUSE_IE_EN));
mtk_spi_set_gpio_pinmux(bus, pad_select);
- clrsetbits_le32(&regs->spi_pad_macro_sel_reg, SPI_PAD_SEL_MASK,
+ clrsetbits32(&regs->spi_pad_macro_sel_reg, SPI_PAD_SEL_MASK,
pad_select);
gpio_output(slave->cs_gpio, 1);
@@ -110,7 +110,7 @@ static int spi_ctrlr_claim_bus(const struct spi_slave *slave)
struct mtk_spi_bus *mtk_slave = to_mtk_spi(slave);
struct mtk_spi_regs *regs = mtk_slave->regs;
- setbits_le32(&regs->spi_cmd_reg, 1 << SPI_CMD_PAUSE_EN_SHIFT);
+ setbits32(&regs->spi_cmd_reg, 1 << SPI_CMD_PAUSE_EN_SHIFT);
mtk_slave->state = MTK_SPI_IDLE;
gpio_output(mtk_slave->cs_gpio, 0);
@@ -135,10 +135,10 @@ static int do_transfer(const struct spi_slave *slave, void *in, const void *out,
else
size = MIN(*bytes_in, *bytes_out);
- clrsetbits_le32(&regs->spi_cfg1_reg,
- SPI_CFG1_PACKET_LENGTH_MASK | SPI_CFG1_PACKET_LOOP_MASK,
- ((size - 1) << SPI_CFG1_PACKET_LENGTH_SHIFT) |
- (0 << SPI_CFG1_PACKET_LOOP_SHIFT));
+ clrsetbits32(&regs->spi_cfg1_reg,
+ SPI_CFG1_PACKET_LENGTH_MASK | SPI_CFG1_PACKET_LOOP_MASK,
+ ((size - 1) << SPI_CFG1_PACKET_LENGTH_SHIFT) |
+ (0 << SPI_CFG1_PACKET_LOOP_SHIFT));
if (*bytes_out) {
const uint8_t *outb = (const uint8_t *)out;
@@ -166,10 +166,10 @@ static int do_transfer(const struct spi_slave *slave, void *in, const void *out,
}
if (mtk_slave->state == MTK_SPI_IDLE) {
- setbits_le32(&regs->spi_cmd_reg, SPI_CMD_ACT_EN);
+ setbits32(&regs->spi_cmd_reg, SPI_CMD_ACT_EN);
mtk_slave->state = MTK_SPI_PAUSE_IDLE;
} else if (mtk_slave->state == MTK_SPI_PAUSE_IDLE) {
- setbits_le32(&regs->spi_cmd_reg, SPI_CMD_RESUME_EN);
+ setbits32(&regs->spi_cmd_reg, SPI_CMD_RESUME_EN);
}
stopwatch_init_usecs_expire(&sw, MTK_TXRX_TIMEOUT_US);
@@ -246,7 +246,7 @@ static void spi_ctrlr_release_bus(const struct spi_slave *slave)
struct mtk_spi_bus *mtk_slave = to_mtk_spi(slave);
struct mtk_spi_regs *regs = mtk_slave->regs;
- clrbits_le32(&regs->spi_cmd_reg, SPI_CMD_PAUSE_EN);
+ clrbits32(&regs->spi_cmd_reg, SPI_CMD_PAUSE_EN);
spi_sw_reset(regs);
mtk_slave->state = MTK_SPI_IDLE;