Hi.
(recent without attachment).
I've just checked in some more code changes. I've touched quite a few
things but I hope I've not broken anything. I think it's quite likely
that there is a failure of backwards compatibility. I'm sorry, but it
should be minor. I'll try to distribute a new XP10 image soon.
The most interesting change is that I've modified the register
generation script a bit and have now started to use the output of this
script in different places. The input file contains settings for the
clock frequencies and these are passed into both the verilog and the
code. (I've only tested this with the pre-production values - there are
three blocks that need to be changed - grep for "pre-production"). I've
changed xp10_top_level.v to have two PLL configs and to select between them.
Some debug got added to the verilog. I'll take it out again if people
want, but it's quite useful. There are four registers in XP10 space
that are counters on each of the four clocks - it's quite nice to see
that they are ticking at the correct frequency.
I've changed the HQ_CONTROL register (actually I've put a new one
somewhere else). I've moved the control bits higher up (I want to play
with having more RAM). I've also made it readable. This change is very
important for making some operations possible.
I've split a large chunk of the code from the oga1utils directory and
put it in a oga1lib directory. This code builds a small library that
contains the logic to control a OGA1. This library very deliberately
does not talk to the hardware. The client of the library must provide
code to do this - this is so that the library code can be used both by a
kernel driver and by an X driver (which have different interfaces to PCI
than from standard user space).
Example clients are in:
tools/oga1utils/oga1 - User space stand-alone program
drivers/xf86-video-ogd - User space X driver
drivers/linux/framebuffer - Kernel framebuffer driver
Some of the caveats of this are that certain things shouldn't be allowed
from within the oga1lib code. You can't call any system call, other
library call or use floating point. This shouldn't be much of a
problem, but needs bearing in mind if you make any changes.
I've tried to extend the SPI code to drive the winbond SPI chip used on
the production boards. I've not got one, so I haven't tested it. If
people are feeling adventurous than it would be good if they had a play
with "oga1-card". This should now read and write all SPI chips that we
have.
I'd be very interested to hear review comments from people. I'm also
sorry that this has come in one large lump, but I've been working on it
for a while, and the time I should spend on this project is getting less.
Happy Hacking,
MM
PS.
I've not touched any of the code in ogd1_diag. I think this should all
still work with the new XP10 image.
PPS.
I've also attached oga1.sh just to show how you can access the OGD1 from
the shell. It's a bit painful but it does work.
#!/bin/bash
OGA1_DEV=05:09.0
# Access an XP10 ENG register using only config space
# This can only access the XP10 registers from the ENG BAR
function xp10_read_config
{
ADDR=$1
# 22 = Address
$(printf "setpci -s $OGA1_DEV 58.L=%x" $ADDR)
# result = 23
RES=$(setpci -s $OGA1_DEV 5C.L)
echo $(( 0x$RES ))
}
# Access something using only config space
function oga1_write_config
{
TARGET=$1
ADDR=$2
VAL=$3
# 18 = Target
$(printf "setpci -s $OGA1_DEV 48.L=%02x" $TARGET)
# 17 = Address
$(printf "setpci -s $OGA1_DEV 44.L=%x" $ADDR)
# 20 = result
$(printf "setpci -s $OGA1_DEV 50.L=%x" $VAL)
}
# Access an ENG register using only config space
function eng_write_config
{
oga1_write_config 0x02 $1 $2
}
# Access MEM using only config space
function mem_write_config
{
oga1_write_config 0x04 $1 $2
}
# Read some HQ data
function hq_data_read
{
ADDR=$1
hq_control=`xp10_read_config 0x80`
eng_write_config 0x80 $(( ($hq_control & 0xf0000000) | ($ADDR & 0x3ff) |
0x400 ))
xp10_read_config 0x84
eng_write_config 0x80 $hq_control
}
# Write some HQ data
function hq_data_write
{
ADDR=$1
DATA=$2
hq_control=`xp10_read_config 0x80`
eng_write_config 0x80 $(( ($hq_control & 0xf0000000) | ($ADDR & 0x3ff) |
0x400 ))
eng_write_config 0x74 $DATA
eng_write_config 0x80 $hq_control
}
printf "%#x\n" `xp10_read_config 0xa0`
eng_write_config 0x7c 0
printf "%#x\n" `xp10_read_config 0x7c`
eng_write_config 0x7c 0x12345678
printf "%#x\n" `xp10_read_config 0x7c`
eng_write_config 0x7c 0x87654321
printf "%#x\n" `xp10_read_config 0x7c`
eng_write_config 0x7c 0
echo "----"
for f in $(seq 0 20)
do
printf "%04x %08x\n" $f `hq_data_read $f`
done
echo "----"
hq_data_write 6 0
hq_data_read 6
#hq_data_write 6 1
#hq_data_read 6
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)