X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fspi%2Fatmel_spi.c;h=ed6278b86fdef4eac9851a7e1dc3802658c27fc6;hb=1a4596601fd395f3afb8f82f3f840c5e00bdd57a;hp=f4b1bad22e85f787212194ff265908139946254e;hpb=009d75ccc11d27b9a083375a88bb93cb746b4800;p=u-boot diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index f4b1bad22e..ed6278b86f 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -1,23 +1,7 @@ /* * Copyright (C) 2007 Atmel Corporation * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include #include @@ -30,6 +14,15 @@ #include "atmel_spi.h" +static int spi_has_wdrbt(struct atmel_spi_slave *slave) +{ + unsigned int ver; + + ver = spi_readl(slave, VERSION); + + return (ATMEL_SPI_VERSION_REV(ver) >= 0x210); +} + void spi_init() { @@ -90,10 +83,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, as->regs = regs; as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS -#if defined(CONFIG_AT91SAM9X5) || defined(CONFIG_AT91SAM9M10G45) - | ATMEL_SPI_MR_WDRBT -#endif | ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf); + if (spi_has_wdrbt(as)) + as->mr |= ATMEL_SPI_MR_WDRBT; + spi_writel(as, CSR(cs), csrx); return &as->slave;