]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: zynq_qspi: Add child pre probe function
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fri, 15 Jul 2022 14:01:16 +0000 (19:31 +0530)
committerMichal Simek <michal.simek@amd.com>
Tue, 26 Jul 2022 07:34:21 +0000 (09:34 +0200)
Add child pre probe function in the driver. Update max_hz of priv from
spi_slave structure.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/1657893679-20039-2-git-send-email-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/spi/zynq_qspi.c

index b69d992b28abba41cc5326770985224aa748378f..066a0c60027fb6e04bd68936bd1a37a04ac06a53 100644 (file)
@@ -94,6 +94,7 @@ struct zynq_qspi_priv {
        u8 mode;
        u8 fifo_depth;
        u32 freq;               /* required frequency */
+       u32 max_hz;
        const void *tx_buf;
        void *rx_buf;
        unsigned len;
@@ -174,6 +175,16 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
        writel(ZYNQ_QSPI_ENR_SPI_EN_MASK, &regs->enr);
 }
 
+static int zynq_qspi_child_pre_probe(struct udevice *bus)
+{
+       struct spi_slave *slave = dev_get_parent_priv(bus);
+       struct zynq_qspi_priv *priv = dev_get_priv(bus->parent);
+
+       priv->max_hz = slave->max_hz;
+
+       return 0;
+}
+
 static int zynq_qspi_probe(struct udevice *bus)
 {
        struct zynq_qspi_plat *plat = dev_get_plat(bus);
@@ -746,4 +757,5 @@ U_BOOT_DRIVER(zynq_qspi) = {
        .plat_auto      = sizeof(struct zynq_qspi_plat),
        .priv_auto      = sizeof(struct zynq_qspi_priv),
        .probe  = zynq_qspi_probe,
+       .child_pre_probe = zynq_qspi_child_pre_probe,
 };