Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/49267 )
Change subject: nicintel_spi.c: Implement `set_sck_set_mosi` and `set_sck_get_miso` ......................................................................
nicintel_spi.c: Implement `set_sck_set_mosi` and `set_sck_get_miso`
Change-Id: I52a0ae5ff331ee2ed41652eb5c2ed7ebe7253d74 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M nicintel_spi.c 1 file changed, 25 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/49267/1
diff --git a/nicintel_spi.c b/nicintel_spi.c index 1173ef7..c068e75 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -167,11 +167,36 @@ return tmp; }
+static void nicintel_bitbang_set_sck_set_mosi(int sck, int mosi) +{ + uint32_t tmp; + + tmp = pci_mmio_readl(nicintel_spibar + FLA); + tmp &= ~BIT(FL_SCK); + tmp &= ~BIT(FL_SI); + tmp |= (sck << FL_SCK); + tmp |= (mosi << FL_SI); + pci_mmio_writel(tmp, nicintel_spibar + FLA); +} + +static int nicintel_bitbang_set_sck_get_miso(int sck) +{ + uint32_t tmp; + + tmp = pci_mmio_readl(nicintel_spibar + FLA); + tmp &= ~BIT(FL_SCK); + tmp |= (sck << FL_SCK); + pci_mmio_writel(tmp, nicintel_spibar + FLA); + return (tmp >> FL_SO) & 0x1; +} + static const struct bitbang_spi_master bitbang_spi_master_nicintel = { .set_cs = nicintel_bitbang_set_cs, .set_sck = nicintel_bitbang_set_sck, .set_mosi = nicintel_bitbang_set_mosi, .get_miso = nicintel_bitbang_get_miso, + .set_sck_set_mosi = nicintel_bitbang_set_sck_set_mosi, + .set_sck_get_miso = nicintel_bitbang_set_sck_get_miso, .request_bus = nicintel_request_spibus, .release_bus = nicintel_release_spibus, .half_period = 1,