[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuiJLK8ncbHH3OhE@euler>
Date: Mon, 1 Aug 2022 19:17:16 -0700
From: Colin Foster <colin.foster@...advantage.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Terry Bowman <terry.bowman@....com>,
Vladimir Oltean <vladimir.oltean@....com>,
Wolfram Sang <wsa@...nel.org>,
Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
Steen Hegelund <Steen.Hegelund@...rochip.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Linus Walleij <linus.walleij@...aro.org>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Russell King <linux@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Lee Jones <lee.jones@...aro.org>, katie.morris@...advantage.com
Subject: Re: [PATCH v14 mfd 9/9] mfd: ocelot: add support for the vsc7512
chip via spi
Hi Andy,
Apologies for the late response. Everything seemed straightforward, but
as I was implementing your suggestions one thing came out.
I just want to make sure my implementation isn't horribly off before the
next patch set.
Specifically this question (copied from below):
> I'm wondering if you can use in both cases
> spi_message_init_with_transfers().
> > +static int ocelot_spi_regmap_bus_read(void *context, const void *reg, size_t reg_size,
> > + void *val, size_t val_size)
> > +{
> > + struct spi_transfer tx, padding, rx;
struct spi_transfer xfers[3] = {0};
struct spi_transfer *xfer_tok = xfers;
> > + struct device *dev = context;
> > + struct ocelot_ddata *ddata;
> > + struct spi_device *spi;
> > + struct spi_message msg;
> > +
> > + ddata = dev_get_drvdata(dev);
> > + spi = to_spi_device(dev);
> > +
> > + spi_message_init(&msg);
> > +
> > + memset(&tx, 0, sizeof(tx));
> > +
> > + tx.tx_buf = reg;
> > + tx.len = reg_size;
xfer_tok->tx_buf = reg;
xfer_tok->len = reg_size;
xfer_tok++;
> > +
> > + spi_message_add_tail(&tx, &msg);
> > +
> > + if (ddata->spi_padding_bytes) {
> > + memset(&padding, 0, sizeof(padding));
> > +
> > + padding.len = ddata->spi_padding_bytes;
> > + padding.tx_buf = ddata->dummy_buf;
> > + padding.dummy_data = 1;
xfer_tok->len
xfer_tok->tx_buf
xfer_tok->dummy_data
xfer_tok++;
> > +
> > + spi_message_add_tail(&padding, &msg);
> > + }
> > +
> > + memset(&rx, 0, sizeof(rx));
> > + rx.rx_buf = val;
> > + rx.len = val_size;
xfer_tok->rx_buf
xfer_tok->len
xfer_tok++;
> > +
> > + spi_message_add_tail(&rx, &msg);
spi_message_init_with_transfers(&msg, xfers, xfer_tok - xfers);
>
> I'm wondering if you can use in both cases
> spi_message_init_with_transfers().
I could see that implementation getting the response of "what the heck
were you thinking" or "that looks alright" and I honestly have no idea
which pool it will fall into.
>
> > + return spi_sync(spi, &msg);
> > +}
>
Powered by blists - more mailing lists