
On Fri, Aug 10, 2018 at 7:11 PM, Adam Ford aford173@gmail.com wrote:
On Fri, Aug 10, 2018 at 8:38 AM Jagan Teki jagan@amarulasolutions.com wrote:
On Wed, Aug 8, 2018 at 6:47 PM, Adam Ford aford173@gmail.com wrote:
On Tue, Aug 7, 2018 at 1:29 AM Jagan Teki jagan@amarulasolutions.com wrote:
davinci_spi now support dt along with platform data, respective boards need to switch into dm for the same.
[snip]
Looking at other drivers, I wonder if this should be +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int davinci_ofdata_to_platadata(struct udevice *bus) {
struct davinci_spi_slave *ds = dev_get_priv(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
struct davinci_spi_platdata *plat = bus->platdata;
fdt_addr_t addr;
ds->regs = devfdt_map_physmem(bus, sizeof(struct davinci_spi_regs));
if (!ds->regs) {
printf("%s: could not map device address\n", __func__);
addr = devfdt_get_addr(bus);
if (addr == FDT_ADDR_T_NONE) return -EINVAL;
}
ds->num_cs = fdtdec_get_int(blob, node, "num-cs", 4);
plat->regs = (struct davinci_spi_regs *)addr;
plat->num_cs = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus), "num-cs", 4); return 0;
}
-static const struct dm_spi_ops davinci_spi_ops = {
.claim_bus = davinci_spi_claim_bus,
.release_bus = davinci_spi_release_bus,
.xfer = davinci_spi_xfer,
.set_speed = davinci_spi_set_speed,
.set_mode = davinci_spi_set_mode,
-};
static const struct udevice_id davinci_spi_ids[] = { { .compatible = "ti,keystone-spi" }, { .compatible = "ti,dm6441-spi" }, { .compatible = "ti,da830-spi" }, { } }; +#endif
U_BOOT_DRIVER(davinci_spi) = { .name = "davinci_spi", .id = UCLASS_SPI, +#if CONFIG_IS_ENABLED(OF_CONTROL)
Like above, should this be: +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
With limited SPL resources, I cannot build OF_CONTROL in SPL and disabling OF_CONTROL in SPL doesn't build either. With the modification, I can build with OF_PLATDATA enabled.
.of_match = davinci_spi_ids,
.ops = &davinci_spi_ops, .ofdata_to_platdata = davinci_ofdata_to_platadata,
.priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
.platdata_auto_alloc_size = sizeof(struct davinci_spi_platdata),
+#endif .probe = davinci_spi_probe,
.ops = &davinci_spi_ops,
.priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
}; -#endif
With the above changes, I can build U-Boot, but I cannot boot with DM_SPL enabled.
For SPL have you initialize pladata some where in board code?
I didn't do that yet, which is probably what part of the problem is. I hadn't gotten around to trying to figure out what the correct method is. Do you have an example I can follow?
Sample.
static const struct davinci_spi_platdata davinci_spi_data = { .regs = (struct davinci_spi_regs *)BASE, .num_cs = 4, };
U_BOOT_DEVICE(davinci_spi) = { "davinci_spi", &davinci_spi_data, };