+// SPDX-License-Identifier: GPL-2.0+
/*
* Altera SPI driver
*
* based on bfin_spi.c
* Copyright (c) 2005-2008 Analog Devices Inc.
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <malloc.h>
-#include <spi.h>
#include <fdtdec.h>
+#include <spi.h>
#include <asm/io.h>
-DECLARE_GLOBAL_DATA_PTR;
+#define ALTERA_SPI_STATUS_RRDY_MSK BIT(7)
+#define ALTERA_SPI_CONTROL_SSO_MSK BIT(10)
#ifndef CONFIG_ALTERA_SPI_IDLE_VAL
-#define CONFIG_ALTERA_SPI_IDLE_VAL 0xff
+#define CONFIG_ALTERA_SPI_IDLE_VAL 0xff
#endif
struct altera_spi_regs {
struct altera_spi_regs *regs;
};
-#define ALTERA_SPI_STATUS_RRDY_MSK (1 << 7)
-#define ALTERA_SPI_CONTROL_SSO_MSK (1 << 10)
-
static void spi_cs_activate(struct udevice *dev, uint cs)
{
struct udevice *bus = dev->parent;
{
struct altera_spi_platdata *plat = dev_get_platdata(bus);
- plat->regs = ioremap(dev_get_addr(bus),
- sizeof(struct altera_spi_regs));
+ plat->regs = map_physmem(devfdt_get_addr(bus),
+ sizeof(struct altera_spi_regs),
+ MAP_NOCACHE);
return 0;
}
};
static const struct udevice_id altera_spi_ids[] = {
- { .compatible = "altr,spi-1.0", },
- { }
+ { .compatible = "altr,spi-1.0" },
+ {}
};
U_BOOT_DRIVER(altera_spi) = {