From: Miquel Raynal <miquel.raynal@bootlin.com>
To: zhengxunli@mxic.com.tw
Cc: juliensu@mxic.com.tw, ycllin@mxic.com.tw, linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/3] spi: mxic: add maximum speed of spi host
Date: Tue, 2 Feb 2021 09:04:24 +0100 [thread overview]
Message-ID: <20210202090424.710e015a@xps13> (raw)
In-Reply-To: <OFCBF59ED0.4C198CA3-ON48258670.00236718-48258670.0026E452@mxic.com.tw>
Hello,
> > > @@ -536,7 +537,9 @@ static int mxic_spi_probe(struct platform_device
> *pdev)
> > > {
> > > struct spi_master *master;
> > > struct resource *res;
> > > + struct device_node *np = pdev->dev.of_node;
> > > struct mxic_spi *mxic;
> > > + u32 max_freq;
> > > int ret;
> > >
> > > master = devm_spi_alloc_master(&pdev->dev, sizeof(struct
> mxic_spi));
> > > @@ -580,6 +583,10 @@ static int mxic_spi_probe(struct platform_device
> *pdev)
> > > SPI_RX_QUAD | SPI_TX_QUAD |
> > > SPI_RX_OCTAL | SPI_TX_OCTAL;
> > >
> > > + if (of_property_read_u32(np, "spi-max-frequency",
> > > + &master->max_speed_hz))
> > > + master->max_speed_hz = 25000000; /* 25MHz */
> >
> > As said before, there are two limitations to take into account:
> > 1- your controller maximum speed
> > 2- your flash maximum speed
> >
> > (1) I don't think this needs to be exported through the DT, the driver
> > knows his own limitations and enforces them.
>
> In fact, if master->max_speed_hz is not set, spi->max_speed_hz will be 0
> and the
> host frequency cannot be set correctly.
You should set master->max_speed_hz in the probe. This is the maximum
speed your host can run at and has *nothing to do* with whatever device
is attached on the bus.
In the DT, use the spi-max-frequency property to inform the controller
about the maximum speed the device supports.
Then the controller should receive requests at the frequency chosen
with: min(master_max_freq, device_max_freq).
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2021-02-02 8:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 8:13 [PATCH 0/3] Add octal DTR support for Macronix flash zhengxunli
2021-01-29 8:13 ` [PATCH 1/3] mtd: spi-nor: macronix: add support for Macronix octaflash zhengxunli
2021-02-01 14:44 ` Miquel Raynal
2021-02-01 15:06 ` Miquel Raynal
2021-02-01 19:55 ` Pratyush Yadav
2021-01-29 8:13 ` [PATCH 2/3] spi: mxic: patch for octal DTR mode support zhengxunli
2021-02-01 14:49 ` Miquel Raynal
2021-02-01 20:10 ` Pratyush Yadav
2021-02-01 21:20 ` Miquel Raynal
[not found] ` <OF6211E4EF.55839180-ON48258670.0011946B-48258670.001EE31F@mxic.com.tw>
2021-02-02 8:06 ` Miquel Raynal
2021-01-29 8:13 ` [PATCH 3/3] spi: mxic: add maximum speed of spi host zhengxunli
2021-02-01 15:02 ` Miquel Raynal
[not found] ` <OFCBF59ED0.4C198CA3-ON48258670.00236718-48258670.0026E452@mxic.com.tw>
2021-02-02 8:04 ` Miquel Raynal [this message]
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=20210202090424.710e015a@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=juliensu@mxic.com.tw \
--cc=linux-mtd@lists.infradead.org \
--cc=ycllin@mxic.com.tw \
--cc=zhengxunli@mxic.com.tw \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox