| 1 |
|
| 2 |
|
| 3 |
#include <device/pci.h> |
| 4 |
#include <drivers/intel/gma/libgfxinit.h> |
| 5 |
#include <intelblocks/early_graphics.h> |
| 6 |
#include <soc/gpio.h> |
| 7 |
#include <soc/pci_devs.h> |
| 8 |
|
| 9 |
static void device_init(void) |
| 10 |
{ |
| 11 |
|
| 12 |
pci_and_config16(SA_DEV_IGD, PCI_COMMAND, |
| 13 |
~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); |
| 14 |
|
| 15 |
|
| 16 |
pci_write_config32(SA_DEV_IGD, PCI_BASE_ADDRESS_0, |
| 17 |
CONFIG_GFX_GMA_DEFAULT_MMIO); |
| 18 |
|
| 19 |
|
| 20 |
pci_or_config16(SA_DEV_IGD, PCI_COMMAND, |
| 21 |
(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); |
| 22 |
} |
| 23 |
|
| 24 |
__weak const struct pad_config *variant_early_graphics_gpio_table(size_t *num) |
| 25 |
{ |
| 26 |
*num = 0; |
| 27 |
return NULL; |
| 28 |
} |
| 29 |
|
| 30 |
bool early_graphics_init(void) |
| 31 |
{ |
| 32 |
int ret; |
| 33 |
const struct pad_config *pads; |
| 34 |
size_t pads_num; |
| 35 |
|
| 36 |
if (!CONFIG(MAINBOARD_USE_EARLY_LIBGFXINIT)) |
| 37 |
return false; |
| 38 |
|
| 39 |
|
| 40 |
device_init(); |
| 41 |
|
| 42 |
|
| 43 |
pads = variant_early_graphics_gpio_table(&pads_num); |
| 44 |
gpio_configure_pads(pads, pads_num); |
| 45 |
|
| 46 |
|
| 47 |
early_graphics_soc_panel_init(); |
| 48 |
|
| 49 |
gma_gfxinit(&ret); |
| 50 |
return !!ret; |
| 51 |
} |
| 52 |
|
| 53 |
void early_graphics_stop(void) |
| 54 |
{ |
| 55 |
if (!CONFIG(MAINBOARD_USE_EARLY_LIBGFXINIT)) |
| 56 |
return; |
| 57 |
|
| 58 |
gma_gfxstop(); |
| 59 |
} |