Patch for radeon on new iBook G4
Hello to everybody
I'm posting a new patch for everybody who has the same problem on the new
iBook G4.
The first time my iBook booted with linux I had the "flickering screen"
problem with a Gentoo live cd. After installing a Debian Sarge beta4 CD, the
screen got black because of the old radeonfb support in the kernel. I always
booted with the video=ofonly option, trying many times to start X.
I upgraded to sid, and then:
- installed the dri trunks (doesn't solve the problem)
- compiled the 2.6.6 vanilla kernel (doesn't solve the problem)
I was getting crazy because my XFree86.log was O.K.!
I always knew it was a framebuffer problem. I booted with the radeonfb (black
screen), then logged in blindly and started x, it worked but the screen was
quite black, had to be "turned on" with the buttons of pbbuttonsd, but was
flickering.
I looked into the code of the patches (radeon-IGP, the benjamin one and other
one found here on the mailing list), and made a cumulative one to avoid
undeclared functions and bits of code shared in the patches.
Everything goes ok!!! I tried it on a 2.6.6 vanilla kernel, but it
was made for a 2.6.4 so it has to work on it.
Don't append anything like video=xxx, the radeon framebuffer will be used.
Daniele
PS: my CPU seems to have few bogomips, what's happening? The processor is too
new? Here is my /proc/cpuinfo
danieli@aibuk:~$ cat /proc/cpuinfo
processor : 0
cpu : 7447A, altivec supported
clock : 1066MHz
revision : 1.1 (pvr 8003 0101)
bogomips : 530.43
machine : PowerBook6,5
motherboard : PowerBook6,5 MacRISC3 Power Macintosh
detected as : 287 (iBook G4)
pmac flags : 0000000a
L2 cache : 512K unified
memory : 256MB
pmac-generation : NewWorld
diff -uprN -X dontdiff clean/drivers/video/aty/radeon_base.c edited/drivers/video/aty/radeon_base.c
--- clean/drivers/video/aty/radeon_base.c 2004-03-10 18:55:25.000000000 -0800
+++ edited/drivers/video/aty/radeon_base.c 2004-04-01 16:10:32.050172056 -0800
@@ -1144,6 +1144,7 @@ static void radeon_write_pll_regs(struct
/* Set PPLL ref. div */
if (rinfo->family == CHIP_FAMILY_R300 ||
+ rinfo->family == CHIP_FAMILY_RS300 ||
rinfo->family == CHIP_FAMILY_R350 ||
rinfo->family == CHIP_FAMILY_RV350) {
if (mode->ppll_ref_div & R300_PPLL_REF_DIV_ACC_MASK) {
@@ -1855,7 +1856,8 @@
rinfo->family == CHIP_FAMILY_RV280 ||
rinfo->family == CHIP_FAMILY_RV350) &&
!machine_is_compatible("PowerBook4,3") &&
- !machine_is_compatible("PowerBook6,3"))
+ !machine_is_compatible("PowerBook6,3") &&
+ !machine_is_compatible("PowerBook6,5"))
conv_table = backlight_conv_m7;
else
conv_table = backlight_conv_m6;
@@ -2129,7 +2130,31 @@ static int radeonfb_pci_register (struct
#endif /* CONFIG_PPC_OF */
/* framebuffer size */
- tmp = INREG(CONFIG_MEMSIZE);
+ if ((rinfo->family == CHIP_FAMILY_RS100) ||
+ (rinfo->family == CHIP_FAMILY_RS200) ||
+ (rinfo->family == CHIP_FAMILY_RS300)) {
+ u32 tom = INREG(NB_TOM);
+ tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024);
+
+ OUTREG(MC_FB_LOCATION, tom);
+ OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
+ OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
+ OUTREG(OV0_BASE_ADDR, (tom & 0xffff) << 16);
+
+ /* This is supposed to fix the crtc2 noise problem. */
+ OUTREG(GRPH2_BUFFER_CNTL, INREG(GRPH2_BUFFER_CNTL) & ~0x7f0000);
+
+ if ((rinfo->family == CHIP_FAMILY_RS100) ||
+ (rinfo->family == CHIP_FAMILY_RS200)) {
+ /* This is to workaround the asic bug for RMX, some versions
+ of BIOS dosen't have this register initialized correctly.
+ */
+ OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN,
+ ~CRTC_H_CUTOFF_ACTIVE_EN);
+ }
+ } else {
+ tmp = INREG(CONFIG_MEMSIZE);
+ }
/* mem size is bits [28:0], mask off the rest */
rinfo->video_ram = tmp & CONFIG_MEMSIZE_MASK;
diff -uprN -X dontdiff clean/include/video/radeon.h edited/include/video/radeon.h
--- clean/include/video/radeon.h 2004-03-10 18:55:54.000000000 -0800
+++ edited/include/video/radeon.h 2004-03-29 18:34:57.000000000 -0800
@@ -73,6 +73,7 @@
#define MEM_IO_CNTL_A0 0x0178
#define MEM_INIT_LATENCY_TIMER 0x0154
#define MEM_SDRAM_MODE_REG 0x0158
+#define NB_TOM 0x015C
#define AGP_BASE 0x0170
#define MEM_IO_CNTL_A1 0x017C
#define MEM_IO_CNTL_B0 0x0180
@@ -173,6 +174,8 @@
#define CUR_CLR1 0x0270
#define FP_HORZ_VERT_ACTIVE 0x0278
#define CRTC_MORE_CNTL 0x027C
+# define CRTC_H_CUTOFF_ACTIVE_EN (1<<4)
+# define CRTC_V_CUTOFF_ACTIVE_EN (1<<5)
#define DAC_EXT_CNTL 0x0280
#define FP_GEN_CNTL 0x0284
#define FP_HORZ_STRETCH 0x028C
@@ -185,6 +188,7 @@
//#define DDA_ON_OFF 0x02e4
#define DVI_I2C_CNTL_1 0x02e4
#define GRPH_BUFFER_CNTL 0x02F0
+#define GRPH2_BUFFER_CNTL 0x03F0
#define VGA_BUFFER_CNTL 0x02F4
#define OV0_Y_X_START 0x0400
#define OV0_Y_X_END 0x0404
diff -uprN -X dontdiff clean/drivers/video/aty/radeon_monitor.c edited/drivers/video/aty/radeon_monitor.c
--- clean/drivers/video/aty/radeon_monitor.c Wed Mar 31 23:41:00 2004
+++ edited/drivers/video/aty/radeon_monitor.c Thu May 13 11:22:36 2004
@@ -653,7 +653,8 @@
rinfo->panel_info.use_bios_dividers = 1;
}
/* iBook G4 */
- if (machine_is_compatible("PowerBook6,3")) {
+ if (machine_is_compatible("PowerBook6,3") |
+ machine_is_compatible("PowerBook6,5")) {
rinfo->panel_info.ref_divider = rinfo->pll.ref_div;
rinfo->panel_info.post_divider = 0x6;
rinfo->panel_info.fbk_divider = 0xad;
Reply to: