Message ID | 20220628162044.1121337-2-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | spi: aspeed: Add a "ranges" property | expand |
On Tue, 28 Jun 2022 at 16:20, Cédric Le Goater <clg@kaod.org> wrote: > > The offset value of the mapping window in the kernel structure is > calculated using the value of the previous window offset. This doesn't > reflect how the HW is configured and can lead to erroneous setting of > the second flash device (CE1). > Did you want to include a Fixes tag? > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > drivers/spi/spi-aspeed-smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c > index 3e891bf22470..5a995b5653f1 100644 > --- a/drivers/spi/spi-aspeed-smc.c > +++ b/drivers/spi/spi-aspeed-smc.c > @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, > windows[cs].cs = cs; > windows[cs].size = data->segment_end(aspi, reg_val) - > data->segment_start(aspi, reg_val); > - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; > + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; Is subtracting the base address correct for the 2400/2500? > dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, > windows[cs].offset, windows[cs].size); > } > -- > 2.35.3 >
On 6/29/22 09:20, Joel Stanley wrote: > On Tue, 28 Jun 2022 at 16:20, Cédric Le Goater <clg@kaod.org> wrote: >> >> The offset value of the mapping window in the kernel structure is >> calculated using the value of the previous window offset. This doesn't >> reflect how the HW is configured and can lead to erroneous setting of >> the second flash device (CE1). >> > > Did you want to include a Fixes tag? I should and one from the correct tree ! Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem") > >> Signed-off-by: Cédric Le Goater <clg@kaod.org> >> --- >> drivers/spi/spi-aspeed-smc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c >> index 3e891bf22470..5a995b5653f1 100644 >> --- a/drivers/spi/spi-aspeed-smc.c >> +++ b/drivers/spi/spi-aspeed-smc.c >> @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, >> windows[cs].cs = cs; >> windows[cs].size = data->segment_end(aspi, reg_val) - >> data->segment_start(aspi, reg_val); >> - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; >> + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; > > Is subtracting the base address correct for the 2400/2500? The segment_start() handlers return absolute physical addresses. Since we want the offset, we could simply : data->segment_start(aspi, reg_val) & (aspi->ahb_window_size - 1); May be better, Thanks, C. > >> dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, >> windows[cs].offset, windows[cs].size); >> } >> -- >> 2.35.3 >>
diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index 3e891bf22470..5a995b5653f1 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, windows[cs].cs = cs; windows[cs].size = data->segment_end(aspi, reg_val) - data->segment_start(aspi, reg_val); - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, windows[cs].offset, windows[cs].size); }
The offset value of the mapping window in the kernel structure is calculated using the value of the previous window offset. This doesn't reflect how the HW is configured and can lead to erroneous setting of the second flash device (CE1). Signed-off-by: Cédric Le Goater <clg@kaod.org> --- drivers/spi/spi-aspeed-smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)