Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
Vladimir Serbinenko | 9772f8d | 2014-08-31 22:12:24 +0200 | [diff] [blame] | 16 | #include <drivers/intel/gma/i915_reg.h> |
| 17 | #include <drivers/intel/gma/drm_dp_helper.h> |
Ronald G. Minnich | a95a13b | 2013-03-05 17:07:40 -0800 | [diff] [blame] | 18 | |
| 19 | /* things that are, strangely, not defined anywhere? */ |
| 20 | #define PCH_PP_UNLOCK 0xabcd0000 |
| 21 | #define WMx_LP_SR_EN (1<<31) |
| 22 | |
| 23 | /* Google Link-specific defines */ |
| 24 | /* how many 4096-byte pages do we need for the framebuffer? |
| 25 | * There are 32 bits per pixel, or 4 bytes, |
| 26 | * which means 1024 pixels per page. |
| 27 | * HencetThere are 4250 GTTs on Link: |
| 28 | * 2650 (X) * 1700 (Y) pixels / 1024 pixels per page. |
| 29 | */ |
| 30 | #define FRAME_BUFFER_PAGES ((2560*1700)/1024) |
| 31 | #define FRAME_BUFFER_BYTES (FRAME_BUFFER_PAGES*4096) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 32 | |
| 33 | /* One-letter commands for code not meant to be ready for humans. |
| 34 | * The code was generated by a set of programs/scripts. |
| 35 | * M print out a kernel message |
| 36 | * R read a register. We do these mainly to ensure that if hardware wanted |
| 37 | * the register read, it was read; also, in debug, we can see what was expected |
| 38 | * and what was found. This has proven *very* useful to get this debugged. |
| 39 | * The udelay, if non-zero, will make sure there is a |
| 40 | * udelay() call with the value. |
| 41 | * The count is from the kernel and tells us how many times this read was done. |
| 42 | * Also useful for debugging and the state |
| 43 | * machine uses the info to drive a poll. |
| 44 | * W Write a register |
| 45 | * V set verbosity. It's a bit mask. |
| 46 | * 0 -> nothing |
| 47 | * 1 -> print kernel messages |
| 48 | * 2 -> print IO ops |
| 49 | * 4 -> print the number of times we spin on a register in a poll |
| 50 | * 8 -> restore whatever the previous verbosity level was |
| 51 | * (only one deep stack) |
| 52 | * |
| 53 | * Again, this is not really meant for human consumption. There is not a poll |
| 54 | * operator as such because, sometimes, there is a read/write/read where the |
| 55 | * second read is a poll, and this chipset is so touchy I'm reluctant to move |
| 56 | * things around and/or delete too many reads. |
| 57 | */ |
| 58 | #define M 1 |
| 59 | #define R 2 |
Ronald G. Minnich | a95a13b | 2013-03-05 17:07:40 -0800 | [diff] [blame] | 60 | #define W 4 |
| 61 | #define V 8 |
| 62 | #define I 16 |
| 63 | #define P 32 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 64 | |
| 65 | struct iodef { |
| 66 | unsigned char op; |
| 67 | unsigned int count; |
| 68 | const char *msg; |
| 69 | unsigned long addr; |
| 70 | unsigned long data; |
| 71 | unsigned long udelay; |
| 72 | }; |
Ronald G. Minnich | 665e3d2 | 2013-02-27 09:54:47 -0800 | [diff] [blame] | 73 | |
| 74 | /* i915.c */ |
| 75 | unsigned long io_i915_READ32(unsigned long addr); |
| 76 | void io_i915_WRITE32(unsigned long val, unsigned long addr); |
| 77 | |
| 78 | /* intel_dp.c */ |
Ronald G. Minnich | a95a13b | 2013-03-05 17:07:40 -0800 | [diff] [blame] | 79 | u32 pack_aux(u32 *src, int src_bytes); |
| 80 | void unpack_aux(u32 src, u32 *dst, int dst_bytes); |
| 81 | int intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u32 *send, int send_bytes, |
| 82 | u32 *recv, int recv_size); |