summaryrefslogtreecommitdiff
path: root/drivers/spi/ich.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/ich.c')
-rw-r--r--drivers/spi/ich.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index a91cb78568..1cd410493b 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -38,17 +38,6 @@
#define debug_trace(x, args...)
#endif
-struct ich_spi_platdata {
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
- struct dtd_intel_fast_spi dtplat;
-#endif
- enum ich_version ich_version; /* Controller version, 7 or 9 */
- bool lockdown; /* lock down controller settings? */
- ulong mmio_base; /* Base of MMIO registers */
- pci_dev_t bdf; /* PCI address used by of-platdata */
- bool hwseq; /* Use hardware sequencing (not s/w) */
-};
-
static u8 ich_readb(struct ich_spi_priv *priv, int reg)
{
u8 value = readb(priv->base + reg);
@@ -139,7 +128,7 @@ static bool ich9_can_do_33mhz(struct udevice *dev)
return speed == 1;
}
-static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase)
+static void spi_lock_down(struct ich_spi_plat *plat, void *sbase)
{
if (plat->ich_version == ICHV_7) {
struct ich7_spi_regs *ich7_spi = sbase;
@@ -152,7 +141,7 @@ static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase)
}
}
-static bool spi_lock_status(struct ich_spi_platdata *plat, void *sbase)
+static bool spi_lock_status(struct ich_spi_plat *plat, void *sbase)
{
int lock = 0;
@@ -264,7 +253,7 @@ static int ich_spi_exec_op_swseq(struct spi_slave *slave,
const struct spi_mem_op *op)
{
struct udevice *bus = dev_get_parent(slave->dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
struct ich_spi_priv *ctlr = dev_get_priv(bus);
uint16_t control;
int16_t opcode_index;
@@ -602,7 +591,7 @@ static int ich_spi_exec_op_hwseq(struct spi_slave *slave,
static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
{
struct udevice *bus = dev_get_parent(slave->dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
int ret;
bootstage_start(BOOTSTAGE_ID_ACCUM_SPI, "fast_spi");
@@ -667,7 +656,7 @@ static int ich_spi_get_basics(struct udevice *bus, bool can_probe,
* 1. Using of-platdata, in which case we have the BDF and can access the
* registers by reading the BAR
* 2. Not using of-platdata, but still with a SPI controller that is on its own
- * PCI PDF. In this case we read the BDF from the parent platdata and again get
+ * PCI PDF. In this case we read the BDF from the parent plat and again get
* the registers by reading the BAR
* 3. Using a SPI controller that is a child of the PCH, in which case we try
* to find the registers by asking the PCH. This only works if the PCH has
@@ -685,9 +674,9 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep,
pci_dev_t spi_bdf;
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
if (device_is_on_pci_bus(bus)) {
- struct pci_child_platdata *pplat;
+ struct pci_child_plat *pplat;
- pplat = dev_get_parent_platdata(bus);
+ pplat = dev_get_parent_plat(bus);
spi_bdf = pplat->devfn;
} else {
enum ich_version ich_version;
@@ -706,7 +695,7 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep,
offsetp);
}
#else
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
/*
* We cannot rely on plat->bdf being set up yet since this method can
@@ -758,7 +747,7 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op)
static int ich_protect_lockdown(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
struct ich_spi_priv *priv = dev_get_priv(dev);
int ret = -ENOSYS;
@@ -788,11 +777,11 @@ static int ich_protect_lockdown(struct udevice *dev)
}
static int ich_init_controller(struct udevice *dev,
- struct ich_spi_platdata *plat,
+ struct ich_spi_plat *plat,
struct ich_spi_priv *ctlr)
{
if (spl_phase() == PHASE_TPL) {
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
int ret;
ret = fast_spi_early_init(plat->bdf, plat->mmio_base);
@@ -871,7 +860,7 @@ static int ich_cache_bios_region(struct udevice *dev)
static int ich_spi_probe(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
struct ich_spi_priv *priv = dev_get_priv(dev);
int ret;
@@ -924,7 +913,7 @@ static int ich_spi_set_mode(struct udevice *bus, uint mode)
static int ich_spi_child_pre_probe(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
struct ich_spi_priv *priv = dev_get_priv(bus);
struct spi_slave *slave = dev_get_parent_priv(dev);
@@ -945,9 +934,9 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
return 0;
}
-static int ich_spi_ofdata_to_platdata(struct udevice *dev)
+static int ich_spi_of_to_plat(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
struct ich_spi_priv *priv = dev_get_priv(dev);
@@ -1004,9 +993,9 @@ U_BOOT_DRIVER(intel_fast_spi) = {
.id = UCLASS_SPI,
.of_match = ich_spi_ids,
.ops = &ich_spi_ops,
- .ofdata_to_platdata = ich_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct ich_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct ich_spi_priv),
+ .of_to_plat = ich_spi_of_to_plat,
+ .plat_auto = sizeof(struct ich_spi_plat),
+ .priv_auto = sizeof(struct ich_spi_priv),
.child_pre_probe = ich_spi_child_pre_probe,
.probe = ich_spi_probe,
.remove = ich_spi_remove,