Message ID | 20170223225357.9572-5-benh@kernel.crashing.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Feb 24, 2017 at 9:23 AM, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > Some braces were missing causing an incorrect calculation. > > Y.C. Chen from Aspeed provided me with the right formula > which I tested on AST2400 and 2500. Y. C. Chen, can you point out this calculation in the programming guide? All of the PLL calculations I can find in the ast2400 documentation are different to this one. Cheers, Joel > > The MCLK isn't currently used by the driver (it will eventually > to filter modes) so the issue isn't catastrophic. > > Also make the printed value a bit more meaningful > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > drivers/gpu/drm/ast/ast_main.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c > index 718c15b..d194af3 100644 > --- a/drivers/gpu/drm/ast/ast_main.c > +++ b/drivers/gpu/drm/ast/ast_main.c > @@ -352,7 +352,7 @@ static int ast_get_dram_info(struct drm_device *dev) > div = 0x1; > break; > } > - ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * 1000); > + ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); > return 0; > } > > @@ -496,7 +496,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) > if (ret) > goto out_free; > ast->vram_size = ast_get_vram_info(dev); > - DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); > + DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", > + ast->mclk, ast->dram_type, > + ast->dram_bus_width, ast->vram_size); > } > > if (need_post) > -- > 2.9.3 >
On Fri, 2017-02-24 at 12:54 +1030, Joel Stanley wrote: > On Fri, Feb 24, 2017 at 9:23 AM, Benjamin Herrenschmidt > <benh@kernel.crashing.org> wrote: > > Some braces were missing causing an incorrect calculation. > > > > Y.C. Chen from Aspeed provided me with the right formula > > which I tested on AST2400 and 2500. > > Y. C. Chen, can you point out this calculation in the programming > guide? > > All of the PLL calculations I can find in the ast2400 documentation > are different to this one. Different PLL register, see my other email. I've checked the result of the calculation on our AST2500 and AST2400 machines. Cheers, Ben. > Cheers, > > Joel > > > > > The MCLK isn't currently used by the driver (it will eventually > > to filter modes) so the issue isn't catastrophic. > > > > Also make the printed value a bit more meaningful > > > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > > --- > > drivers/gpu/drm/ast/ast_main.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/ast/ast_main.c > > b/drivers/gpu/drm/ast/ast_main.c > > index 718c15b..d194af3 100644 > > --- a/drivers/gpu/drm/ast/ast_main.c > > +++ b/drivers/gpu/drm/ast/ast_main.c > > @@ -352,7 +352,7 @@ static int ast_get_dram_info(struct drm_device > > *dev) > > div = 0x1; > > break; > > } > > - ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * > > 1000); > > + ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * > > 1000)); > > return 0; > > } > > > > @@ -496,7 +496,9 @@ int ast_driver_load(struct drm_device *dev, > > unsigned long flags) > > if (ret) > > goto out_free; > > ast->vram_size = ast_get_vram_info(dev); > > - DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast- > > >dram_type, ast->dram_bus_width, ast->vram_size); > > + DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d > > size=%08x\n", > > + ast->mclk, ast->dram_type, > > + ast->dram_bus_width, ast->vram_size); > > } > > > > if (need_post) > > -- > > 2.9.3 > >
On Fri, Feb 24, 2017 at 1:08 PM, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > On Fri, 2017-02-24 at 12:54 +1030, Joel Stanley wrote: >> On Fri, Feb 24, 2017 at 9:23 AM, Benjamin Herrenschmidt >> <benh@kernel.crashing.org> wrote: >> > Some braces were missing causing an incorrect calculation. >> > >> > Y.C. Chen from Aspeed provided me with the right formula >> > which I tested on AST2400 and 2500. >> >> Y. C. Chen, can you point out this calculation in the programming >> guide? >> >> All of the PLL calculations I can find in the ast2400 documentation >> are different to this one. > > Different PLL register, see my other email. I've checked the result > of the calculation on our AST2500 and AST2400 machines. I see now. It woudl be good to see the calculation added to Aspeed's documentation in the future. Acked-by: Joel Stanley <joel@jms.id.au> Cheers, Joel
Tested-by: Y.C. Chen <yc_chen@aspeedtech.com> -----Original Message----- From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org] Sent: Friday, February 24, 2017 6:54 AM To: dri-devel@lists.freedesktop.org Cc: YC Chen <yc_chen@aspeedtech.com>; airlied@redhat.com; eich@suse.come; linuxppc-dev@ozlabs.org Subject: [PATCH 05/12] drm/ast: Fix calculation of MCLK Some braces were missing causing an incorrect calculation. Y.C. Chen from Aspeed provided me with the right formula which I tested on AST2400 and 2500. The MCLK isn't currently used by the driver (it will eventually to filter modes) so the issue isn't catastrophic. Also make the printed value a bit more meaningful Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 718c15b..d194af3 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -352,7 +352,7 @@ static int ast_get_dram_info(struct drm_device *dev) div = 0x1; break; } - ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * 1000); + ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); return 0; } @@ -496,7 +496,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) if (ret) goto out_free; ast->vram_size = ast_get_vram_info(dev); - DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); + DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", + ast->mclk, ast->dram_type, + ast->dram_bus_width, ast->vram_size); } if (need_post)
Some braces were missing causing an incorrect calculation. Y.C. Chen from Aspeed provided me with the right formula which I tested on AST2400 and 2500. The MCLK isn't currently used by the driver (it will eventually to filter modes) so the issue isn't catastrophic. Also make the printed value a bit more meaningful Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- drivers/gpu/drm/ast/ast_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)