WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / gma500 / gma_device.c
blob869f303925667e51cecc8302af6626976982bbd7
1 // SPDX-License-Identifier: GPL-2.0-only
2 /**************************************************************************
3 * Copyright (c) 2011, Intel Corporation.
4 * All Rights Reserved.
6 **************************************************************************/
8 #include "psb_drv.h"
10 void gma_get_core_freq(struct drm_device *dev)
12 uint32_t clock;
13 struct pci_dev *pci_root =
14 pci_get_domain_bus_and_slot(pci_domain_nr(dev->pdev->bus),
15 0, 0);
16 struct drm_psb_private *dev_priv = dev->dev_private;
18 /*pci_write_config_dword(pci_root, 0xD4, 0x00C32004);*/
19 /*pci_write_config_dword(pci_root, 0xD0, 0xE0033000);*/
21 pci_write_config_dword(pci_root, 0xD0, 0xD0050300);
22 pci_read_config_dword(pci_root, 0xD4, &clock);
23 pci_dev_put(pci_root);
25 switch (clock & 0x07) {
26 case 0:
27 dev_priv->core_freq = 100;
28 break;
29 case 1:
30 dev_priv->core_freq = 133;
31 break;
32 case 2:
33 dev_priv->core_freq = 150;
34 break;
35 case 3:
36 dev_priv->core_freq = 178;
37 break;
38 case 4:
39 dev_priv->core_freq = 200;
40 break;
41 case 5:
42 case 6:
43 case 7:
44 dev_priv->core_freq = 266;
45 break;
46 default:
47 dev_priv->core_freq = 0;