On Tue, May 15, 2018 at 5:59 PM, Alex Deucher <alexdeucher at gmail.com> wrote: > From: Shaoyun Liu <Shaoyun.Liu at amd.com> > > v2: cleanups (Alex) > v3: make it vega20 only (Alex) > > Signed-off-by: Shaoyun Liu <Shaoyun.Liu at amd.com> > Acked-by: Alex Deucher <alexander.deucher at amd.com> > Signed-off-by: Alex Deucher <alexander.deucher at amd.com> > --- > drivers/gpu/drm/amd/amdgpu/emu_soc.c | 10091 +++++++++++++++++++++++++++++++++ > 1 file changed, 10091 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/emu_soc.c b/drivers/gpu/drm/amd/amdgpu/emu_soc.c > index d72c25c1b987..91f00fbe550a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/emu_soc.c > +++ b/drivers/gpu/drm/amd/amdgpu/emu_soc.c > @@ -26,8 +26,10099 @@ > #include "soc15_common.h" > #include "soc15_hw_ip.h" > > +static void wreg32_idx_byteoffset(struct amdgpu_device *adev, u32 offset, u32 value) { > + > + static u32 maxoffset = 0; > + static int count = 0; > + > + WREG32(0xc, offset); > + RREG32(0xc); > + WREG32(0xd, value); > + RREG32(0xd); > + > + if (offset > maxoffset) > + maxoffset = offset; > + > + count++; > + if (count % 100 == 0) { > + DRM_INFO("%5d registers written, max offset %08x\n", count, maxoffset); > + msleep(1); > + } > + > +} > + > +static void vg20_lsd_soc_init_with_umc(struct amdgpu_device *adev) > +{ > + > + wreg32_idx_byteoffset(adev, 0x10131800, 0x40a40); > + wreg32_idx_byteoffset(adev, 0x10141010, 0x10000000); > + wreg32_idx_byteoffset(adev, 0x10134008, 0xfa042021); > + wreg32_idx_byteoffset(adev, 0x387C, 0x3); Indentation (double tabs). Could this be done in a similar way as amdgpu_device_program_register_sequence() instead of thousands of function calls? > + > int emu_soc_asic_init(struct amdgpu_device *adev) > { > + if (adev->asic_type == CHIP_VEGA20) { > + vg20_lsd_soc_init_with_umc(adev); > + > + amdgpu_device_program_register_sequence(adev, > + (const u32 *)vega20_golden_init, Unneeded cast. Gražvydas