Skip to content

Commit cbbe555

Browse files
committed
Current work on Radeon 5450 card based on Coreforge's patch.
1 parent 6f5c7a0 commit cbbe555

File tree

10 files changed

+109
-12
lines changed

10 files changed

+109
-12
lines changed

drivers/gpu/drm/radeon/atom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,8 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
729729
cjiffies = jiffies;
730730
if (time_after(cjiffies, ctx->last_jump_jiffies)) {
731731
cjiffies -= ctx->last_jump_jiffies;
732-
if ((jiffies_to_msecs(cjiffies) > 5000)) {
733-
DRM_ERROR("atombios stuck in loop for more than 5secs aborting\n");
732+
if ((jiffies_to_msecs(cjiffies) > 30000)) {
733+
DRM_ERROR("atombios stuck in loop for more than 30secs aborting\n");
734734
ctx->abort = true;
735735
}
736736
} else {

drivers/gpu/drm/radeon/radeon_bios.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ static bool radeon_read_bios(struct radeon_device *rdev)
101101
pci_unmap_rom(rdev->pdev, bios);
102102
return false;
103103
}
104-
memcpy_fromio(rdev->bios, bios, size);
104+
//memcpy_fromio(rdev->bios, bios, size);
105+
int pos;
106+
for(pos = 0;pos < size; pos++){
107+
//memcpy_fromio(rdev->bios+pos,bios+pos,1);
108+
rdev->bios[pos] = __raw_readb(bios+pos);
109+
}
105110
pci_unmap_rom(rdev->pdev, bios);
106111
return true;
107112
}

drivers/gpu/drm/radeon/radeon_device.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,35 @@ void radeon_wb_fini(struct radeon_device *rdev)
446446
}
447447
}
448448

449+
//memset_io with only 32-bit accesses
450+
void memset_io_pcie_wb(volatile void __iomem *dst, int c, size_t count)
451+
{
452+
u32 qc = (u8)c;
453+
454+
qc |= qc << 8;
455+
qc |= qc << 16;
456+
//qc |= qc << 32;
457+
mb();
458+
while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
459+
__raw_writeb(c, dst);
460+
dst++;
461+
count--;
462+
}
463+
464+
while (count >= 4) {
465+
__raw_writel(qc, dst);
466+
dst += 4;
467+
count -= 4;
468+
}
469+
470+
while (count) {
471+
__raw_writeb(c, dst);
472+
dst++;
473+
count--;
474+
}
475+
}
476+
477+
449478
/**
450479
* radeon_wb_init- Init Writeback driver info and allocate memory
451480
*
@@ -490,7 +519,7 @@ int radeon_wb_init(struct radeon_device *rdev)
490519
}
491520

492521
/* clear wb memory */
493-
memset((char *)rdev->wb.wb, 0, RADEON_GPU_PAGE_SIZE);
522+
memset_io_pcie_wb((char *)rdev->wb.wb, 0, RADEON_GPU_PAGE_SIZE);
494523
/* disable event_write fences */
495524
rdev->wb.use_event = false;
496525
/* disabled via module param */

drivers/gpu/drm/radeon/radeon_fb.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,36 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
209209
return ret;
210210
}
211211

212+
//memset_io with only 32-bit accesses
213+
void memset_io_pcie(volatile void __iomem *dst, int c, size_t count)
214+
{
215+
u64 qc = (u8)c;
216+
217+
qc |= qc << 8;
218+
qc |= qc << 16;
219+
//qc |= qc << 32;
220+
221+
__iowmb();
222+
223+
while (count && !IS_ALIGNED((unsigned long)dst, 16)) {
224+
__raw_writeb(c, dst);
225+
dst++;
226+
count--;
227+
}
228+
229+
while (count >= 4) {
230+
__raw_writel(qc, dst);
231+
dst += 4;
232+
count -= 4;
233+
}
234+
235+
while (count) {
236+
__raw_writeb(c, dst);
237+
dst++;
238+
count--;
239+
}
240+
}
241+
212242
static int radeonfb_create(struct drm_fb_helper *helper,
213243
struct drm_fb_helper_surface_size *sizes)
214244
{
@@ -262,7 +292,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
262292
/* setup helper */
263293
rfbdev->helper.fb = fb;
264294

265-
memset_io(rbo->kptr, 0x0, radeon_bo_size(rbo));
295+
memset_io_pcie(rbo->kptr, 0x0, radeon_bo_size(rbo));
266296

267297
info->fbops = &radeonfb_ops;
268298

drivers/gpu/drm/radeon/radeon_object.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ int radeon_bo_create(struct radeon_device *rdev,
220220
bo->flags &= ~RADEON_GEM_GTT_WC;
221221
#endif
222222

223+
//Write combining may cause issues on the raspberry pi
224+
bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
225+
bo->flags |= RADEON_GEM_GTT_UC;
226+
223227
radeon_ttm_placement_from_domain(bo, domain);
224228
/* Kernel allocation are uninterruptible */
225229
down_read(&rdev->pm.mclk_lock);

drivers/gpu/drm/radeon/radeon_ttm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ static int radeon_ttm_backend_bind(struct ttm_device *bdev,
456456
ttm->num_pages, bo_mem, ttm);
457457
}
458458
if (ttm->caching == ttm_cached)
459-
flags |= RADEON_GART_PAGE_SNOOP;
459+
printk("TTM Page would've been snooped\n");
460+
// flags |= RADEON_GART_PAGE_SNOOP;
460461
r = radeon_gart_bind(rdev, gtt->offset, ttm->num_pages,
461462
ttm->pages, gtt->ttm.dma_address, flags);
462463
if (r) {

drivers/gpu/drm/radeon/radeon_vm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,8 @@ int radeon_vm_bo_update(struct radeon_device *rdev,
952952
if (mem->mem_type == TTM_PL_TT) {
953953
bo_va->flags |= RADEON_VM_PAGE_SYSTEM;
954954
if (!(bo_va->bo->flags & (RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC)))
955-
bo_va->flags |= RADEON_VM_PAGE_SNOOPED;
955+
printk("VM Page would've been set to snooped\n");
956+
//bo_va->flags |= RADEON_VM_PAGE_SNOOPED;
956957

957958
} else {
958959
addr += rdev->vm_manager.vram_base_offset;

drivers/gpu/drm/radeon/rs600.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,10 @@ void rs600_gart_set_page(struct radeon_device *rdev, unsigned i,
660660
uint64_t entry)
661661
{
662662
void __iomem *ptr = (void *)rdev->gart.ptr;
663-
writeq(entry, ptr + (i * 8));
663+
uint32_t high = entry >> 32;
664+
writel(entry,ptr+(i*8));
665+
writel(high,ptr + (i*8) + 4);
666+
//writeq(entry, ptr + (i * 8));
664667
}
665668

666669
int rs600_irq_set(struct radeon_device *rdev)

drivers/video/fbdev/core/cfbcopyarea.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,22 @@
3434
# define FB_WRITEL fb_writel
3535
# define FB_READL fb_readl
3636
#else
37-
# define FB_WRITEL fb_writeq
38-
# define FB_READL fb_readq
37+
# define FB_WRITEL fb_writel_writeq
38+
# define FB_READL fb_readl_readq
3939
#endif
4040

41+
static void fb_writel_writeq(u64 val, volatile void __iomem *addr){
42+
fb_writel(val,addr);
43+
fb_writel(val >> 32, addr + 4);
44+
}
45+
46+
static u64 fb_readl_readq(volatile void __iomem *addr){
47+
u64 val;
48+
val = fb_readl(addr);
49+
val |= fb_readl(addr + 4) << 32;
50+
return val;
51+
}
52+
4153
/*
4254
* Generic bitwise copy algorithm
4355
*/

drivers/video/fbdev/core/cfbfillrect.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@
2323
# define FB_WRITEL fb_writel
2424
# define FB_READL fb_readl
2525
#else
26-
# define FB_WRITEL fb_writeq
27-
# define FB_READL fb_readq
26+
# define FB_WRITEL fb_writel_writeq
27+
# define FB_READL fb_readl_readq
2828
#endif
2929

30+
static void fb_writel_writeq(u64 val, volatile void __iomem *addr){
31+
fb_writel(val,addr);
32+
fb_writel(val >> 32, addr + 4);
33+
}
34+
35+
static u64 fb_readl_readq(volatile void __iomem *addr){
36+
u64 val;
37+
val = fb_readl(addr);
38+
val |= fb_readl(addr + 4) << 32;
39+
return val;
40+
}
41+
3042
/*
3143
* Aligned pattern fill using 32/64-bit memory accesses
3244
*/

0 commit comments

Comments
 (0)