// SPDX-License-Identifier: GPL-2.0+
/*
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/
*
* Driver for SPI controller on DaVinci. Based on atmel_spi.c
* by Atmel Corporation
* Copyright (C) 2007 Atmel Corporation
*/
-#include <common.h>
+#include <config.h>
#include <log.h>
#include <spi.h>
#include <malloc.h>
+#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <dm.h>
SPIPC0_DOFUN_MASK | SPIPC0_DIFUN_MASK), &ds->regs->pc0);
/* setup format */
- scalar = ((CONFIG_SYS_SPI_CLK / ds->freq) - 1) & 0xFF;
+ scalar = ((CFG_SYS_SPI_CLK / ds->freq) - 1) & 0xFF;
/*
* Use following format:
struct davinci_spi_slave *ds = dev_get_priv(bus);
debug("%s speed %u\n", __func__, max_hz);
- if (max_hz > CONFIG_SYS_SPI_CLK / 2)
+ if (max_hz > CFG_SYS_SPI_CLK / 2)
return -EINVAL;
ds->freq = max_hz;
static int davinci_spi_claim_bus(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct davinci_spi_slave *ds = dev_get_priv(bus);
const void *dout, void *din,
unsigned long flags)
{
- struct dm_spi_slave_platdata *slave =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave =
+ dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct davinci_spi_slave *ds = dev_get_priv(bus);
static int davinci_spi_probe(struct udevice *bus)
{
struct davinci_spi_slave *ds = dev_get_priv(bus);
- struct davinci_spi_platdata *plat = bus->platdata;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
ds->regs = plat->regs;
ds->num_cs = plat->num_cs;
return 0;
}
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
static int davinci_ofdata_to_platadata(struct udevice *bus)
{
- struct davinci_spi_platdata *plat = bus->platdata;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
fdt_addr_t addr;
addr = dev_read_addr(bus);
U_BOOT_DRIVER(davinci_spi) = {
.name = "davinci_spi",
.id = UCLASS_SPI,
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
.of_match = davinci_spi_ids,
- .ofdata_to_platdata = davinci_ofdata_to_platadata,
- .platdata_auto_alloc_size = sizeof(struct davinci_spi_platdata),
+ .of_to_plat = davinci_ofdata_to_platadata,
+ .plat_auto = sizeof(struct davinci_spi_plat),
#endif
.probe = davinci_spi_probe,
.ops = &davinci_spi_ops,
- .priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
+ .priv_auto = sizeof(struct davinci_spi_slave),
};