All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Ford <aford173@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] spi: davinci: Add platdata support
Date: Mon, 1 Oct 2018 16:57:31 -0500	[thread overview]
Message-ID: <CAHCN7xKAavcCZovqUgjh1dAdVDjj6j1sDjhGQCB22St3D=APzQ@mail.gmail.com> (raw)
In-Reply-To: <CAHCN7xKXCu1AU2+7bworPPD7F8mBSysV+Z3g1-dP20KaYnZQ4g@mail.gmail.com>

On Mon, Oct 1, 2018 at 7:54 AM Adam Ford <aford173@gmail.com> wrote:
>
> On Mon, Sep 3, 2018 at 5:22 PM Adam Ford <aford173@gmail.com> wrote:
> >
> > On Mon, Sep 3, 2018 at 5:21 PM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > On Mon, Sep 3, 2018 at 12:30 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > > >
> > > > Davanci spi driver has DM support already, this patch
> > > > add support for platdata so-that SPL can use it for
> > > > low foot-print.
> > > >
> > >
> > > In order for this to work, I had to apply a patch [1] that I submitted before.
> > > That patch disabled the manual initialization of the UART in da850_lowlevel.c
> > > to not conflict with the DM version of initialization.
> > >
> > > Assuming that [1] gets applied first then this, you can add me as
> > > 'tested-by' on
> > > both patches 1 of 3 and 2 of 3.  I don't have the hardware to test 3 of 3.
> > >
> > > [1] - https://patchwork.ozlabs.org/patch/957336/
> > >
> > > adam
> > >
> >
> > I should have stated, that without the [1] patch, this does does not work.
>
> The patch I mentioned is applied.  I am back in the US and ready and
> willing to test/retest  anything.
> If you want me to just retest this patch as-is, I can do so, if you
> want to rebase against master and sent out updated patches, I can do
> that too.  If you have a git repo you want me to pull, I can test from
> there too.
>
> As of 30 September 2018, the master branch booted the da850-evm and
> the concern I had about DM_SERIAL has been applied, so I am confident
> for at least the da850-evm your patch series should allow us to enable
> DM and boot both SPL (with OF_PLATDATA) and U-Boot.
>
> adam
>
> >
> > adam
> > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Tested-by: Adam Ford <aford173@gmail.com>

> > > > ---
> > > >  drivers/spi/davinci_spi.c              | 47 +++++++++++++++-----------
> > > >  include/dm/platform_data/spi_davinci.h | 15 ++++++++
> > > >  2 files changed, 43 insertions(+), 19 deletions(-)
> > > >  create mode 100644 include/dm/platform_data/spi_davinci.h
> > > >
> > > > diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
> > > > index a822858323..07fa5e3b8a 100644
> > > > --- a/drivers/spi/davinci_spi.c
> > > > +++ b/drivers/spi/davinci_spi.c
> > > > @@ -14,6 +14,7 @@
> > > >  #include <asm/io.h>
> > > >  #include <asm/arch/hardware.h>
> > > >  #include <dm.h>
> > > > +#include <dm/platform_data/spi_davinci.h>
> > > >
> > > >  /* SPIGCR0 */
> > > >  #define SPIGCR0_SPIENA_MASK    0x1
> > > > @@ -529,50 +530,58 @@ static int davinci_spi_xfer(struct udevice *dev, unsigned int bitlen,
> > > >         return __davinci_spi_xfer(ds, bitlen, dout, din, flags);
> > > >  }
> > > >
> > > > +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 int davinci_spi_probe(struct udevice *bus)
> > > >  {
> > > > -       /* Nothing to do */
> > > > +       struct davinci_spi_slave *ds = dev_get_priv(bus);
> > > > +       struct davinci_spi_platdata *plat = bus->platdata;
> > > > +       ds->regs = plat->regs;
> > > > +       ds->num_cs = plat->num_cs;
> > > > +
> > > >         return 0;
> > > >  }
> > > >
> > > > +#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) && !CONFIG_IS_ENABLED(OF_PLATDATA)
> > > >         .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
> > > > diff --git a/include/dm/platform_data/spi_davinci.h b/include/dm/platform_data/spi_davinci.h
> > > > new file mode 100644
> > > > index 0000000000..fbc62c262a
> > > > --- /dev/null
> > > > +++ b/include/dm/platform_data/spi_davinci.h
> > > > @@ -0,0 +1,15 @@
> > > > +/*
> > > > + * Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
> > > > + *
> > > > + * SPDX-License-Identifier:    GPL-2.0+
> > > > + */
> > > > +
> > > > +#ifndef __spi_davinci_h
> > > > +#define __spi_davinci_h
> > > > +
> > > > +struct davinci_spi_platdata {
> > > > +       struct davinci_spi_regs *regs;
> > > > +       u8 num_cs;         /* total no. of CS available */
> > > > +};
> > > > +
> > > > +#endif /* __spi_davinci_h */
> > > > --
> > > > 2.18.0.321.gffc6fa0e3
> > > >

  reply	other threads:[~2018-10-01 21:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 17:30 [U-Boot] [PATCH 1/3] spi: davinci: Add platdata support Jagan Teki
2018-09-03 17:30 ` [U-Boot] [PATCH 2/3] board: da8xxevm: Add SPL DM for serial, spi Jagan Teki
2018-10-01 21:58   ` Adam Ford
2018-10-10  6:11   ` Jagan Teki
2018-09-03 17:30 ` [U-Boot] [PATCH 3/3] configs: omapl138_lcdk: Enable DM_SPI, DM_SPI_FLASH Jagan Teki
2018-09-03 22:21 ` [U-Boot] [PATCH 1/3] spi: davinci: Add platdata support Adam Ford
2018-09-03 22:22   ` Adam Ford
2018-10-01 12:54     ` Adam Ford
2018-10-01 21:57       ` Adam Ford [this message]
2018-10-07  1:39         ` Adam Ford
2018-10-10  6:10 ` Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHCN7xKAavcCZovqUgjh1dAdVDjj6j1sDjhGQCB22St3D=APzQ@mail.gmail.com' \
    --to=aford173@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.