diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2013-03-05 17:07:40 -0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-03-20 05:34:41 +0100 |
commit | a95a13bd474fa7738840496b657cd46784e3f6b2 (patch) | |
tree | 88284d3cea4ec0692e0acc7679669b0e12be4be9 /src/mainboard/google/link/intel_dp.c | |
parent | ec2d914e198928f89928838476ddbd6e5ef61b98 (diff) |
link/graphics: New state machine
This is a new state machine. It is more programmatic, in the
case of auxio, and has much more symbolic naming, and very few
"magic" numbers, except in the case of undocumented settings.
As before, the 'pre-computed' IO ops are encoded in the iodefs
table. A function, run, is passed and index into the table and
runs the ops.
A new operator, I, has been added. When the I operator is hit,
run() returns the index of the next operator in the table.
The i915lightup function runs the table. All the AUX channel ops
have been removed from the table, however, and are now called as
functions, using the previously committed auxio function.
The iodefs table has been grouped into blocks of ops, which end in
an I operator. As the lightup function progresses through startup,
and the run() returns, the lightup function performs aux channel
operations.
This code is symbolic enough, I hope, that it will make haswell
graphics bringup simpler.
i915io.c, and the core of the code in i915lightup.c, were
programatically generated, starting with IO logs from the DRM
startup code in the kernel. It is possible to apply the tools that
do this generation to newer IO logs from the kernel.
Change-Id: I8a8e121dc0d9674f0c6a866343b28e179a1e3d8a
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/google/link/intel_dp.c')
-rw-r--r-- | src/mainboard/google/link/intel_dp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mainboard/google/link/intel_dp.c b/src/mainboard/google/link/intel_dp.c index b2160a13f6..9fb66f6cb7 100644 --- a/src/mainboard/google/link/intel_dp.c +++ b/src/mainboard/google/link/intel_dp.c @@ -32,8 +32,9 @@ #include "i915io.h" u32 -pack_aux(u8 *src, int src_bytes) +pack_aux(u32 *src32, int src_bytes) { + u8 *src = (u8 *)src32; int i; u32 v = 0; @@ -45,8 +46,10 @@ pack_aux(u8 *src, int src_bytes) } void -unpack_aux(u32 src, u8 *dst, int dst_bytes) +unpack_aux(u32 src, u32 *dst32, int dst_bytes) { + u8 *dst = (u8 *)dst32; + int i; if (dst_bytes > 4) dst_bytes = 4; @@ -55,8 +58,8 @@ unpack_aux(u32 src, u8 *dst, int dst_bytes) } int -intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u8 *send, int send_bytes, - u8 *recv, int recv_size) +intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u32 *send, int send_bytes, + u32 *recv, int recv_size) { int i; int recv_bytes; @@ -93,11 +96,10 @@ intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u8 *send, int send_bytes, for (try = 0; try < 5; try++) { /* Load the send data into the aux channel data registers */ for (i = 0; i < send_bytes; i += 4) - io_i915_WRITE32(ch_data + i, - pack_aux(send + i, send_bytes - i)); + io_i915_WRITE32(send[i], ch_data + i); /* Send the command and wait for it to complete */ - io_i915_WRITE32(ch_ctl, + io_i915_WRITE32( DP_AUX_CH_CTL_SEND_BUSY | DP_AUX_CH_CTL_TIME_OUT_400us | (send_bytes << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) | @@ -105,7 +107,7 @@ intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u8 *send, int send_bytes, (aux_clock_divider << DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT) | DP_AUX_CH_CTL_DONE | DP_AUX_CH_CTL_TIME_OUT_ERROR | - DP_AUX_CH_CTL_RECEIVE_ERROR); + DP_AUX_CH_CTL_RECEIVE_ERROR, ch_ctl); for (;;) { status = io_i915_READ32(ch_ctl); if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) @@ -114,11 +116,11 @@ intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u8 *send, int send_bytes, } /* Clear done status and any errors */ - io_i915_WRITE32(ch_ctl, + io_i915_WRITE32( status | DP_AUX_CH_CTL_DONE | DP_AUX_CH_CTL_TIME_OUT_ERROR | - DP_AUX_CH_CTL_RECEIVE_ERROR); + DP_AUX_CH_CTL_RECEIVE_ERROR, ch_ctl); if (status & (DP_AUX_CH_CTL_TIME_OUT_ERROR | DP_AUX_CH_CTL_RECEIVE_ERROR)) |