From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Costantino Pistagna <valvoline@tiscalinet.it>
Cc: linuxppc-dev list <linuxppc-dev@lists.linuxppc.org>
Subject: Re: ibook G4 Status Report
Date: Thu, 12 Feb 2004 09:18:44 +1100 [thread overview]
Message-ID: <1076537923.866.133.camel@gaston> (raw)
In-Reply-To: <015F12CA-5CC6-11D8-B40D-000A95B30208@tiscalinet.it>
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
>
> I've noticed this problem. the only way to get XFree working properly,
> is
> to use the UseFBDev directive into XF86Config. Unfortunately, this
> directive
> seems to get in troubles with dualhead XF86Config (i've used the one
> that i'm
> using in my desktop, equipped with a Rage128): the panels are waiting
> for
> something with a black screen. If it's usefull, i'm using an XFree
> 4.3.0 binary
> merged with gentoo/ppc.
Ok, you need to use XFree without UseFBDev. This cause some flicker on
your LCD, and then run the enclosed hack which should fix the flicker. Let
me know if that helps. XFree without UseFBDev will also screw up switching
back to console unfortunately, I have a hack for that (remove all the vgaXXX
calls in XFree) locally.
I expect to have full support of dual head in radeonfb not too far from
now, though there will be some work needed for XFree to be able to "use"
it... I hope that work could easily be included in Michel's packages at
least :)
Note that if the enclosed lcd_hack.c doesn't work, try adding that line
to it at the end:
OUTPLL(3,0xc);
Let me know.
Ben.
[-- Attachment #2: lcd_hack.c --]
[-- Type: text/x-c, Size: 2930 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <byteswap.h>
#include <linux/fb.h>
#include <errno.h>
#include "radeon.h"
void * mmio;
#define RADEON_RBASE 0xb0000000
//#define RADEON_RBASE 0x90000000
static inline unsigned char regr8(void *base, const unsigned long offset)
{
unsigned char val;
__asm__ __volatile__(
"lbzx %0,%1,%2\n\t"
"eieio"
: "=r" (val)
: "b" (base), "r" (offset),
"m" (*((volatile unsigned char *)base+offset)));
return(val);
}
static inline void regw8(void *base, const unsigned long offset,
const unsigned char val)
{
__asm__ __volatile__ ("stbx %1,%2,%3\n\t"
"eieio"
: "=m" (*((volatile unsigned char *)base+offset))
: "r" (val), "b" (base), "r" (offset));
}
static inline unsigned int regr(void *base, const unsigned long offset)
{
unsigned int val;
__asm__ __volatile__ ("lwbrx %0,%1,%2\n\t"
"eieio"
: "=r" (val)
: "b" (base), "r"(offset),
"m" (*((volatile unsigned char *)base+offset)));
return val;
}
static inline void regw(void *base, const unsigned long offset,
const unsigned int val)
{
__asm__ __volatile__ ("stwbrx %1,%2,%3\n\t"
"eieio"
: "=m" (*((volatile unsigned char *)base+offset))
: "r"(val), "b"(base), "r"(offset));
}
static inline unsigned int pllr(void *base, const unsigned long index)
{
unsigned int val;
regw8(base, 0x8, index & 0x3f);
return regr(base, 0xc);
}
#define INREG(r) regr(mmio, (r))
#define OUTREG(r, v) regw(mmio, (r), (v))
#define INREG8(r) regr8(mmio, (r))
#define OUTREG8(r, v) regw8(mmio, (r), (v))
#define OUTPLL(addr,val) \
do { \
OUTREG8(CLOCK_CNTL_INDEX, (addr & 0x0000003f) | 0x00000080); \
OUTREG(CLOCK_CNTL_DATA, val); \
} while(0)
static inline unsigned long _INPLL(unsigned long addr)
{
OUTREG8(CLOCK_CNTL_INDEX, addr & 0x0000003f);
return (INREG(CLOCK_CNTL_DATA));
}
#define INPLL(addr) _INPLL(addr)
int main() {
int fd, fbfd, i;
unsigned int cci;
struct fb_fix_screeninfo fix;
fbfd = open("/dev/fb0", O_RDWR);
if (fbfd == -1) {
perror("cannot open framebuffer\n");
return ENODEV;
}
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &fix)) {
perror("cannot get sceen info\n");
return ENODEV;
}
if (fix.accel != FB_ACCEL_ATI_RADEON) {
fprintf(stderr, "not a radeon !\n");
return ENODEV;
}
fd = open("/dev/mem", O_RDWR);
if (fd == -1) {
perror("cannot open /dev/mem\n");
return ENODEV;
}
mmio = (void *)mmap(0, 0x80000, PROT_READ|PROT_WRITE,
MAP_SHARED, fd, fix.mmio_start);
/* Force switch to PLL0 */
printf("Frobbing radeon PLL...\n");
cci = INREG(8);
OUTREG(8, cci & ~0x00000300);
}
next prev parent reply other threads:[~2004-02-11 22:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-09 17:48 ibook G4 Status Report Costantino Pistagna
2004-02-09 21:10 ` Benjamin Herrenschmidt
2004-02-11 16:44 ` Costantino Pistagna
2004-02-11 19:10 ` Costantino Pistagna
2004-02-11 22:18 ` Benjamin Herrenschmidt [this message]
2004-02-12 6:07 ` Costantino Pistagna
2004-02-12 9:12 ` how to link a posix function John Zhou
2004-02-09 21:13 ` ibook G4 Status Report Brad Boyer
-- strict thread matches above, loose matches on Subject: below --
2004-02-22 11:18 Costantino Pistagna
2004-02-22 21:07 ` Benjamin Herrenschmidt
2004-02-24 17:41 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1076537923.866.133.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=valvoline@tiscalinet.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).