Nico Huber has posted comments on this change. ( https://review.coreboot.org/26946 )
Change subject: bitbang_spi: Add functions to optimize xfers
......................................................................
Patch Set 2: Code-Review+2
(3 comments)
You are right, you didn't change the clocking. It just looks confusing
now. Btw. changing from CPOL=0 CPHA=0 to CPOL=1 CPHA=1 is no big deal,
the only difference is the idle state of the clock.
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c
File bitbang_spi.c:
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c@47
PS2, Line 47: static void bitbang_spi_set_sck_set_mosi(const struct bitbang_spi_master * const master, int sck, int mosi)
Now that I looked again, the `sck` parameter is not needed, its
always called with the same value. Could be renamed to `bitbang_
spi_clear_sck_set_mosi()` if you want to get rid of it.
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c@114
PS2, Line 114: bitbang_spi_set_sck_set_mosi(master, 0, 0);
> I don't really understand what you mean here. […]
You are right. All I saw was that we start at 0 and the first
thing we do in the loop is set to 0 again, that seemed wrong.
And I see now why, the code was wrong all the time. Your change
just makes it more obvious.
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c@157
PS2, Line 157: bitbang_spi_set_sck(master, 0);
> You mean change from a CPOL=0, CPHA=0 controller into a CPOL=1, CPHA=1 controller (using terminology […]
I didn't mean to change it to further optimize but to correct it.
I hope you didn't stare at the diagram on Wikipedia as long as I
did, it is wrong as well (or at least doesn't reflect the descrip-
tion).
Let's see what CPOL=0 CPHA=0 really means. Leading edge is 0 to 1,
trailing edge is 1 to 0. Now it says "For CPHA=0, the "out" side
changes the data on the trailing edge of the preceding clock cycle".
But with this code, there is no preceding clock cycle. I'm not sure
if that is valid. But it doesn't matter as all slave implementations
just sample when they see the rising edge.
--
To view, visit https://review.coreboot.org/26946
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3430a9df34844cdfa82e109456be788eaa1789a
Gerrit-Change-Number: 26946
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 26 Jun 2018 18:06:43 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
Daniel Thompson has posted comments on this change. ( https://review.coreboot.org/26947 )
Change subject: bitbang_spi: Add half-duplex optimizations
......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/#/c/26947/2/bitbang_spi.c
File bitbang_spi.c:
https://review.coreboot.org/#/c/26947/2/bitbang_spi.c@128
PS2, Line 128: if (i == 0)
: bitbang_spi_set_sck_set_mosi(master, 0, 0);
: else
: bitbang_spi_set_sck(master, 0);
> I wouldn't expect the state of MOSI to matter. Though, I never read […]
SPI is an ad-hoc standard; very little is defined anywhere!
I assume that the half-duplex protocol used for FLASH is described in a JEDEC document somewhere. Unfortunately so far I haven't found it... so when I developed these patches I worked pretty hard to preserve the existing behaviour as much as possible.
In other words the original code parked MOSI at 0 so this patch does the same thing.
https://review.coreboot.org/#/c/26947/2/bitbang_spi.c@141
PS2, Line 141: uint8_t val)
> Nit, we have a 112 chars line limit, so no line break needed here.
Will fix.
--
To view, visit https://review.coreboot.org/26947
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I33b9f363716f651146c09113bda5fffe53b16738
Gerrit-Change-Number: 26947
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 26 Jun 2018 18:02:38 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Daniel Thompson has posted comments on this change. ( https://review.coreboot.org/26946 )
Change subject: bitbang_spi: Add functions to optimize xfers
......................................................................
Patch Set 2:
(2 comments)
Nico: Not sure I understood your review comments but I've replied anyway.
Right now I don't plan to act (based on my estimation of the benefit) but if you really do want me to investigate what happens if we change the idle state of the clock then let me know.
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c
File bitbang_spi.c:
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c@114
PS2, Line 114: bitbang_spi_set_sck_set_mosi(master, 0, 0);
> Shouldn't we start with CLK = 1 now?
I don't really understand what you mean here.
I've not really changed how the clocking works with this patch. Other than the combining the clk/mosi/miso changes the only other change is to move bitbang_spi_set_clk() from the end of the byte loop to the beginning so it could be combined with the mosi (and adding in the final set_clk to ensure we idle the clock at the right polarity).
https://review.coreboot.org/#/c/26946/2/bitbang_spi.c@157
PS2, Line 157: bitbang_spi_set_sck(master, 0);
> Wouldn't be needed if we assume CLK = 1 between commands.
You mean change from a CPOL=0, CPHA=0 controller into a CPOL=1, CPHA=1 controller (using terminology from https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Clock_polarity_an… )?
I don't think that belongs in *this* patch (since its a much bigger change).
I guess I could look into it but my gut feeling is that the gains would be extremely marginal.
The effect of my combined patches was to reduce the packet count to the CP210x from 32 packets per byte to 24 packets per *byte*. Changing the idling polarity would save no more than 2 packets per *command*. Even for a tiny two byte transfer the gains will be pretty small and I believe most of the runtime is spent doing *much* bigger transfers where 2 packets would probably be lost in the noise.
--
To view, visit https://review.coreboot.org/26946
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3430a9df34844cdfa82e109456be788eaa1789a
Gerrit-Change-Number: 26946
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 26 Jun 2018 16:34:28 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/26946 )
Change subject: bitbang_spi: Add functions to optimize xfers
......................................................................
Patch Set 2: Code-Review+1
> (2 comments)
>
> As this changes the timing, I would like some confirmation that
> it doesn't break nicintel_spi (the only bitbang master that sets
> .half_period). I would expect it to work fine, though, and assume
> that the delay is not needed for it anyway.
This was tested with the forementioned device, no signs of breakage were shown (I can dig up the device ID).
--
To view, visit https://review.coreboot.org/26946
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3430a9df34844cdfa82e109456be788eaa1789a
Gerrit-Change-Number: 26946
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Thompson <daniel.thompson(a)linaro.org>
Gerrit-Reviewer: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Mon, 25 Jun 2018 01:03:02 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
Nico Huber has posted comments on this change. ( https://review.coreboot.org/23022 )
Change subject: make args for -r/-w/-v non-positional and optional
......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/#/c/23022/13/cli_classic.c
File cli_classic.c:
https://review.coreboot.org/#/c/23022/13/cli_classic.c@601
PS13, Line 601: This is checked later since it requires
: * processing the layout/fmap first.
It is checked later indeed. But the layout is already processed
here, AFAICS.
--
To view, visit https://review.coreboot.org/23022
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iefbcb7dc4fefe26f5afd1292dfd5c1687fa62803
Gerrit-Change-Number: 23022
Gerrit-PatchSet: 13
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Louis Yung-Chieh Lo <yjlou(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 24 Jun 2018 18:28:29 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Nico Huber has posted comments on this change. ( https://review.coreboot.org/23022 )
Change subject: make args for -r/-w/-v non-positional and optional
......................................................................
Patch Set 13: Code-Review+1
So here is a +1 for overall sanity of the implementation. I still don't
like the syntax and non-positional argument story. And if we don't keep
full compatibility, I'd rather start over with a stricter, more expli-
cit and easier to parse syntax.
But if the two of you want it in, go ahead. The manpage still seems to
miss the fact that the filename argument is non-positional btw.
--
To view, visit https://review.coreboot.org/23022
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iefbcb7dc4fefe26f5afd1292dfd5c1687fa62803
Gerrit-Change-Number: 23022
Gerrit-PatchSet: 13
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Louis Yung-Chieh Lo <yjlou(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 24 Jun 2018 18:11:24 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes