diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/rs690.c')
-rw-r--r-- | drivers/gpu/drm/radeon/rs690.c | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 27547175cf93..1e22f52d6039 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -131,24 +131,25 @@ void rs690_pm_info(struct radeon_device *rdev) | |||
131 | 131 | ||
132 | void rs690_vram_info(struct radeon_device *rdev) | 132 | void rs690_vram_info(struct radeon_device *rdev) |
133 | { | 133 | { |
134 | uint32_t tmp; | ||
135 | fixed20_12 a; | 134 | fixed20_12 a; |
136 | 135 | ||
137 | rs400_gart_adjust_size(rdev); | 136 | rs400_gart_adjust_size(rdev); |
138 | /* DDR for all card after R300 & IGP */ | 137 | |
139 | rdev->mc.vram_is_ddr = true; | 138 | rdev->mc.vram_is_ddr = true; |
140 | /* FIXME: is this correct for RS690/RS740 ? */ | 139 | rdev->mc.vram_width = 128; |
141 | tmp = RREG32(RADEON_MEM_CNTL); | 140 | |
142 | if (tmp & R300_MEM_NUM_CHANNELS_MASK) { | ||
143 | rdev->mc.vram_width = 128; | ||
144 | } else { | ||
145 | rdev->mc.vram_width = 64; | ||
146 | } | ||
147 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); | 141 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); |
148 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; | 142 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; |
149 | 143 | ||
150 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); | 144 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); |
151 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); | 145 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); |
146 | |||
147 | if (rdev->mc.mc_vram_size > rdev->mc.aper_size) | ||
148 | rdev->mc.mc_vram_size = rdev->mc.aper_size; | ||
149 | |||
150 | if (rdev->mc.real_vram_size > rdev->mc.aper_size) | ||
151 | rdev->mc.real_vram_size = rdev->mc.aper_size; | ||
152 | |||
152 | rs690_pm_info(rdev); | 153 | rs690_pm_info(rdev); |
153 | /* FIXME: we should enforce default clock in case GPU is not in | 154 | /* FIXME: we should enforce default clock in case GPU is not in |
154 | * default setup | 155 | * default setup |
@@ -161,6 +162,21 @@ void rs690_vram_info(struct radeon_device *rdev) | |||
161 | rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a); | 162 | rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a); |
162 | } | 163 | } |
163 | 164 | ||
165 | static int rs690_mc_init(struct radeon_device *rdev) | ||
166 | { | ||
167 | int r; | ||
168 | u32 tmp; | ||
169 | |||
170 | /* Setup GPU memory space */ | ||
171 | tmp = RREG32_MC(R_000100_MCCFG_FB_LOCATION); | ||
172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; | ||
173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | ||
174 | r = radeon_mc_setup(rdev); | ||
175 | if (r) | ||
176 | return r; | ||
177 | return 0; | ||
178 | } | ||
179 | |||
164 | void rs690_line_buffer_adjust(struct radeon_device *rdev, | 180 | void rs690_line_buffer_adjust(struct radeon_device *rdev, |
165 | struct drm_display_mode *mode1, | 181 | struct drm_display_mode *mode1, |
166 | struct drm_display_mode *mode2) | 182 | struct drm_display_mode *mode2) |
@@ -244,8 +260,9 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, | |||
244 | 260 | ||
245 | b.full = rfixed_const(mode->crtc_hdisplay); | 261 | b.full = rfixed_const(mode->crtc_hdisplay); |
246 | c.full = rfixed_const(256); | 262 | c.full = rfixed_const(256); |
247 | a.full = rfixed_mul(wm->num_line_pair, b); | 263 | a.full = rfixed_div(b, c); |
248 | request_fifo_depth.full = rfixed_div(a, c); | 264 | request_fifo_depth.full = rfixed_mul(a, wm->num_line_pair); |
265 | request_fifo_depth.full = rfixed_ceil(request_fifo_depth); | ||
249 | if (a.full < rfixed_const(4)) { | 266 | if (a.full < rfixed_const(4)) { |
250 | wm->lb_request_fifo_depth = 4; | 267 | wm->lb_request_fifo_depth = 4; |
251 | } else { | 268 | } else { |
@@ -374,6 +391,7 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, | |||
374 | a.full = rfixed_const(16); | 391 | a.full = rfixed_const(16); |
375 | wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay); | 392 | wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay); |
376 | wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a); | 393 | wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a); |
394 | wm->priority_mark_max.full = rfixed_ceil(wm->priority_mark_max); | ||
377 | 395 | ||
378 | /* Determine estimated width */ | 396 | /* Determine estimated width */ |
379 | estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full; | 397 | estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full; |
@@ -383,6 +401,7 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, | |||
383 | } else { | 401 | } else { |
384 | a.full = rfixed_const(16); | 402 | a.full = rfixed_const(16); |
385 | wm->priority_mark.full = rfixed_div(estimated_width, a); | 403 | wm->priority_mark.full = rfixed_div(estimated_width, a); |
404 | wm->priority_mark.full = rfixed_ceil(wm->priority_mark); | ||
386 | wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; | 405 | wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; |
387 | } | 406 | } |
388 | } | 407 | } |
@@ -605,7 +624,6 @@ static int rs690_startup(struct radeon_device *rdev) | |||
605 | if (r) | 624 | if (r) |
606 | return r; | 625 | return r; |
607 | /* Enable IRQ */ | 626 | /* Enable IRQ */ |
608 | rdev->irq.sw_int = true; | ||
609 | rs600_irq_set(rdev); | 627 | rs600_irq_set(rdev); |
610 | /* 1M ring buffer */ | 628 | /* 1M ring buffer */ |
611 | r = r100_cp_init(rdev, 1024 * 1024); | 629 | r = r100_cp_init(rdev, 1024 * 1024); |
@@ -640,6 +658,8 @@ int rs690_resume(struct radeon_device *rdev) | |||
640 | atom_asic_init(rdev->mode_info.atom_context); | 658 | atom_asic_init(rdev->mode_info.atom_context); |
641 | /* Resume clock after posting */ | 659 | /* Resume clock after posting */ |
642 | rv515_clock_startup(rdev); | 660 | rv515_clock_startup(rdev); |
661 | /* Initialize surface registers */ | ||
662 | radeon_surface_init(rdev); | ||
643 | return rs690_startup(rdev); | 663 | return rs690_startup(rdev); |
644 | } | 664 | } |
645 | 665 | ||
@@ -662,7 +682,7 @@ void rs690_fini(struct radeon_device *rdev) | |||
662 | rs400_gart_fini(rdev); | 682 | rs400_gart_fini(rdev); |
663 | radeon_irq_kms_fini(rdev); | 683 | radeon_irq_kms_fini(rdev); |
664 | radeon_fence_driver_fini(rdev); | 684 | radeon_fence_driver_fini(rdev); |
665 | radeon_object_fini(rdev); | 685 | radeon_bo_fini(rdev); |
666 | radeon_atombios_fini(rdev); | 686 | radeon_atombios_fini(rdev); |
667 | kfree(rdev->bios); | 687 | kfree(rdev->bios); |
668 | rdev->bios = NULL; | 688 | rdev->bios = NULL; |
@@ -700,10 +720,9 @@ int rs690_init(struct radeon_device *rdev) | |||
700 | RREG32(R_0007C0_CP_STAT)); | 720 | RREG32(R_0007C0_CP_STAT)); |
701 | } | 721 | } |
702 | /* check if cards are posted or not */ | 722 | /* check if cards are posted or not */ |
703 | if (!radeon_card_posted(rdev) && rdev->bios) { | 723 | if (radeon_boot_test_post_card(rdev) == false) |
704 | DRM_INFO("GPU not posted. posting now...\n"); | 724 | return -EINVAL; |
705 | atom_asic_init(rdev->mode_info.atom_context); | 725 | |
706 | } | ||
707 | /* Initialize clocks */ | 726 | /* Initialize clocks */ |
708 | radeon_get_clock_info(rdev->ddev); | 727 | radeon_get_clock_info(rdev->ddev); |
709 | /* Initialize power management */ | 728 | /* Initialize power management */ |
@@ -711,7 +730,7 @@ int rs690_init(struct radeon_device *rdev) | |||
711 | /* Get vram informations */ | 730 | /* Get vram informations */ |
712 | rs690_vram_info(rdev); | 731 | rs690_vram_info(rdev); |
713 | /* Initialize memory controller (also test AGP) */ | 732 | /* Initialize memory controller (also test AGP) */ |
714 | r = r420_mc_init(rdev); | 733 | r = rs690_mc_init(rdev); |
715 | if (r) | 734 | if (r) |
716 | return r; | 735 | return r; |
717 | rv515_debugfs(rdev); | 736 | rv515_debugfs(rdev); |
@@ -723,7 +742,7 @@ int rs690_init(struct radeon_device *rdev) | |||
723 | if (r) | 742 | if (r) |
724 | return r; | 743 | return r; |
725 | /* Memory manager */ | 744 | /* Memory manager */ |
726 | r = radeon_object_init(rdev); | 745 | r = radeon_bo_init(rdev); |
727 | if (r) | 746 | if (r) |
728 | return r; | 747 | return r; |
729 | r = rs400_gart_init(rdev); | 748 | r = rs400_gart_init(rdev); |