1a61127c2SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
25c49fd3aSAlan Cox /**************************************************************************
35c49fd3aSAlan Cox * Copyright (c) 2007-2011, Intel Corporation.
45c49fd3aSAlan Cox * All Rights Reserved.
55c49fd3aSAlan Cox *
65c49fd3aSAlan Cox **************************************************************************/
75c49fd3aSAlan Cox
85c49fd3aSAlan Cox #ifndef _PSB_DRV_H_
95c49fd3aSAlan Cox #define _PSB_DRV_H_
105c49fd3aSAlan Cox
115c49fd3aSAlan Cox #include <linux/kref.h>
120edf6813SSouptick Joarder #include <linux/mm_types.h>
135c49fd3aSAlan Cox
1451474335SSam Ravnborg #include <drm/drm_device.h>
15d825c565SSam Ravnborg
165c49fd3aSAlan Cox #include "gtt.h"
170c7b178aSSam Ravnborg #include "intel_bios.h"
18ac1b01b0SPatrik Jakobsson #include "mmu.h"
190c7b178aSSam Ravnborg #include "oaktrail.h"
200c7b178aSSam Ravnborg #include "opregion.h"
210c7b178aSSam Ravnborg #include "power.h"
220c7b178aSSam Ravnborg #include "psb_intel_drv.h"
230c7b178aSSam Ravnborg #include "psb_reg.h"
245c49fd3aSAlan Cox
25f90cd811SArthur Borsboom #define DRIVER_AUTHOR "Alan Cox <alan@linux.intel.com> and others"
26f90cd811SArthur Borsboom
27f90cd811SArthur Borsboom #define DRIVER_NAME "gma500"
28f90cd811SArthur Borsboom #define DRIVER_DESC "DRM driver for the Intel GMA500, GMA600, GMA3600, GMA3650"
29f90cd811SArthur Borsboom #define DRIVER_DATE "20140314"
30f90cd811SArthur Borsboom
31f90cd811SArthur Borsboom #define DRIVER_MAJOR 1
32f90cd811SArthur Borsboom #define DRIVER_MINOR 0
33f90cd811SArthur Borsboom #define DRIVER_PATCHLEVEL 0
34f90cd811SArthur Borsboom
355c49fd3aSAlan Cox /* Append new drm mode definition here, align with libdrm definition */
365c49fd3aSAlan Cox #define DRM_MODE_SCALE_NO_SCALE 2
375c49fd3aSAlan Cox
38a2c68495SThomas Zimmermann #define IS_PSB(drm) ((to_pci_dev((drm)->dev)->device & 0xfffe) == 0x8108)
39a2c68495SThomas Zimmermann #define IS_MRST(drm) ((to_pci_dev((drm)->dev)->device & 0xfff0) == 0x4100)
40a2c68495SThomas Zimmermann #define IS_CDV(drm) ((to_pci_dev((drm)->dev)->device & 0xfff0) == 0x0be0)
415c49fd3aSAlan Cox
429083eb38SArthur Borsboom /* Hardware offsets */
435c49fd3aSAlan Cox #define PSB_VDC_OFFSET 0x00000000
445c49fd3aSAlan Cox #define PSB_VDC_SIZE 0x000080000
455c49fd3aSAlan Cox #define MRST_MMIO_SIZE 0x0000C0000
465c49fd3aSAlan Cox #define PSB_SGX_SIZE 0x8000
475c49fd3aSAlan Cox #define PSB_SGX_OFFSET 0x00040000
485c49fd3aSAlan Cox #define MRST_SGX_OFFSET 0x00080000
499083eb38SArthur Borsboom
509083eb38SArthur Borsboom /* PCI resource identifiers */
515c49fd3aSAlan Cox #define PSB_MMIO_RESOURCE 0
522657929dSPatrik Jakobsson #define PSB_AUX_RESOURCE 0
535c49fd3aSAlan Cox #define PSB_GATT_RESOURCE 2
545c49fd3aSAlan Cox #define PSB_GTT_RESOURCE 3
559083eb38SArthur Borsboom
569083eb38SArthur Borsboom /* PCI configuration */
575c49fd3aSAlan Cox #define PSB_GMCH_CTRL 0x52
585c49fd3aSAlan Cox #define PSB_BSM 0x5C
595c49fd3aSAlan Cox #define _PSB_GMCH_ENABLED 0x4
605c49fd3aSAlan Cox #define PSB_PGETBL_CTL 0x2020
615c49fd3aSAlan Cox #define _PSB_PGETBL_ENABLED 0x00000001
625c49fd3aSAlan Cox #define PSB_SGX_2D_SLAVE_PORT 0x4000
635a52b1f2SJan Safrata #define PSB_LPC_GBA 0x44
645c49fd3aSAlan Cox
659083eb38SArthur Borsboom /* TODO: To get rid of */
665c49fd3aSAlan Cox #define PSB_TT_PRIV0_LIMIT (256*1024*1024)
675c49fd3aSAlan Cox #define PSB_TT_PRIV0_PLIMIT (PSB_TT_PRIV0_LIMIT >> PAGE_SHIFT)
685c49fd3aSAlan Cox
699083eb38SArthur Borsboom /* SGX side MMU definitions (these can probably go) */
705c49fd3aSAlan Cox
719083eb38SArthur Borsboom /* Flags for external memory type field */
725c49fd3aSAlan Cox #define PSB_MMU_CACHED_MEMORY 0x0001 /* Bind to MMU only */
735c49fd3aSAlan Cox #define PSB_MMU_RO_MEMORY 0x0002 /* MMU RO memory */
745c49fd3aSAlan Cox #define PSB_MMU_WO_MEMORY 0x0004 /* MMU WO memory */
759083eb38SArthur Borsboom
769083eb38SArthur Borsboom /* PTE's and PDE's */
775c49fd3aSAlan Cox #define PSB_PDE_MASK 0x003FFFFF
785c49fd3aSAlan Cox #define PSB_PDE_SHIFT 22
795c49fd3aSAlan Cox #define PSB_PTE_SHIFT 12
809083eb38SArthur Borsboom
819083eb38SArthur Borsboom /* Cache control */
825c49fd3aSAlan Cox #define PSB_PTE_VALID 0x0001 /* PTE / PDE valid */
835c49fd3aSAlan Cox #define PSB_PTE_WO 0x0002 /* Write only */
845c49fd3aSAlan Cox #define PSB_PTE_RO 0x0004 /* Read only */
855c49fd3aSAlan Cox #define PSB_PTE_CACHED 0x0008 /* CPU cache coherent */
865c49fd3aSAlan Cox
879083eb38SArthur Borsboom /* VDC registers and bits */
885c49fd3aSAlan Cox #define PSB_MSVDX_CLOCKGATING 0x2064
895c49fd3aSAlan Cox #define PSB_TOPAZ_CLOCKGATING 0x2068
905c49fd3aSAlan Cox #define PSB_HWSTAM 0x2098
915c49fd3aSAlan Cox #define PSB_INSTPM 0x20C0
925c49fd3aSAlan Cox #define PSB_INT_IDENTITY_R 0x20A4
93d839ede4SAlan Cox #define _PSB_IRQ_ASLE (1<<0)
945c49fd3aSAlan Cox #define _MDFLD_PIPEC_EVENT_FLAG (1<<2)
955c49fd3aSAlan Cox #define _MDFLD_PIPEC_VBLANK_FLAG (1<<3)
965c49fd3aSAlan Cox #define _PSB_DPST_PIPEB_FLAG (1<<4)
975c49fd3aSAlan Cox #define _MDFLD_PIPEB_EVENT_FLAG (1<<4)
985c49fd3aSAlan Cox #define _PSB_VSYNC_PIPEB_FLAG (1<<5)
995c49fd3aSAlan Cox #define _PSB_DPST_PIPEA_FLAG (1<<6)
1005c49fd3aSAlan Cox #define _PSB_PIPEA_EVENT_FLAG (1<<6)
1015c49fd3aSAlan Cox #define _PSB_VSYNC_PIPEA_FLAG (1<<7)
10268cb638fSAlan Cox #define _PSB_IRQ_DISP_HOTSYNC (1<<17)
1035c49fd3aSAlan Cox #define _PSB_IRQ_SGX_FLAG (1<<18)
1045c49fd3aSAlan Cox #define _PSB_IRQ_MSVDX_FLAG (1<<19)
1055c49fd3aSAlan Cox #define _LNC_IRQ_TOPAZ_FLAG (1<<20)
1065c49fd3aSAlan Cox
107700e59f6SPatrik Jakobsson #define _PSB_PIPE_EVENT_FLAG (_PSB_VSYNC_PIPEA_FLAG | \
108700e59f6SPatrik Jakobsson _PSB_VSYNC_PIPEB_FLAG)
109700e59f6SPatrik Jakobsson
1105c49fd3aSAlan Cox #define PSB_INT_IDENTITY_R 0x20A4
1115c49fd3aSAlan Cox #define PSB_INT_MASK_R 0x20A8
1125c49fd3aSAlan Cox #define PSB_INT_ENABLE_R 0x20A0
1135c49fd3aSAlan Cox
1145c49fd3aSAlan Cox #define _PSB_MMU_ER_MASK 0x0001FF00
1155c49fd3aSAlan Cox #define _PSB_MMU_ER_HOST (1 << 16)
1165c49fd3aSAlan Cox #define GPIOA 0x5010
1175c49fd3aSAlan Cox #define GPIOB 0x5014
1185c49fd3aSAlan Cox #define GPIOC 0x5018
1195c49fd3aSAlan Cox #define GPIOD 0x501c
1205c49fd3aSAlan Cox #define GPIOE 0x5020
1215c49fd3aSAlan Cox #define GPIOF 0x5024
1225c49fd3aSAlan Cox #define GPIOG 0x5028
1235c49fd3aSAlan Cox #define GPIOH 0x502c
1245c49fd3aSAlan Cox #define GPIO_CLOCK_DIR_MASK (1 << 0)
1255c49fd3aSAlan Cox #define GPIO_CLOCK_DIR_IN (0 << 1)
1265c49fd3aSAlan Cox #define GPIO_CLOCK_DIR_OUT (1 << 1)
1275c49fd3aSAlan Cox #define GPIO_CLOCK_VAL_MASK (1 << 2)
1285c49fd3aSAlan Cox #define GPIO_CLOCK_VAL_OUT (1 << 3)
1295c49fd3aSAlan Cox #define GPIO_CLOCK_VAL_IN (1 << 4)
1305c49fd3aSAlan Cox #define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
1315c49fd3aSAlan Cox #define GPIO_DATA_DIR_MASK (1 << 8)
1325c49fd3aSAlan Cox #define GPIO_DATA_DIR_IN (0 << 9)
1335c49fd3aSAlan Cox #define GPIO_DATA_DIR_OUT (1 << 9)
1345c49fd3aSAlan Cox #define GPIO_DATA_VAL_MASK (1 << 10)
1355c49fd3aSAlan Cox #define GPIO_DATA_VAL_OUT (1 << 11)
1365c49fd3aSAlan Cox #define GPIO_DATA_VAL_IN (1 << 12)
1375c49fd3aSAlan Cox #define GPIO_DATA_PULLUP_DISABLE (1 << 13)
1385c49fd3aSAlan Cox
1395c49fd3aSAlan Cox #define VCLK_DIVISOR_VGA0 0x6000
1405c49fd3aSAlan Cox #define VCLK_DIVISOR_VGA1 0x6004
1415c49fd3aSAlan Cox #define VCLK_POST_DIV 0x6010
1425c49fd3aSAlan Cox
1435c49fd3aSAlan Cox #define PSB_COMM_2D (PSB_ENGINE_2D << 4)
1445c49fd3aSAlan Cox #define PSB_COMM_3D (PSB_ENGINE_3D << 4)
1455c49fd3aSAlan Cox #define PSB_COMM_TA (PSB_ENGINE_TA << 4)
1465c49fd3aSAlan Cox #define PSB_COMM_HP (PSB_ENGINE_HP << 4)
1475c49fd3aSAlan Cox #define PSB_COMM_USER_IRQ (1024 >> 2)
1485c49fd3aSAlan Cox #define PSB_COMM_USER_IRQ_LOST (PSB_COMM_USER_IRQ + 1)
1495c49fd3aSAlan Cox #define PSB_COMM_FW (2048 >> 2)
1505c49fd3aSAlan Cox
1515c49fd3aSAlan Cox #define PSB_UIRQ_VISTEST 1
1525c49fd3aSAlan Cox #define PSB_UIRQ_OOM_REPLY 2
1535c49fd3aSAlan Cox #define PSB_UIRQ_FIRE_TA_REPLY 3
1545c49fd3aSAlan Cox #define PSB_UIRQ_FIRE_RASTER_REPLY 4
1555c49fd3aSAlan Cox
1565c49fd3aSAlan Cox #define PSB_2D_SIZE (256*1024*1024)
1575c49fd3aSAlan Cox #define PSB_MAX_RELOC_PAGES 1024
1585c49fd3aSAlan Cox
1595c49fd3aSAlan Cox #define PSB_LOW_REG_OFFS 0x0204
1605c49fd3aSAlan Cox #define PSB_HIGH_REG_OFFS 0x0600
1615c49fd3aSAlan Cox
1625c49fd3aSAlan Cox #define PSB_NUM_VBLANKS 2
1635c49fd3aSAlan Cox
164bfd8303aSDaniel Vetter #define PSB_WATCHDOG_DELAY (HZ * 2)
1655c49fd3aSAlan Cox
1661f90b123SHans de Goede #define PSB_MAX_BRIGHTNESS 100
1671f90b123SHans de Goede
1685c49fd3aSAlan Cox #define PSB_PWR_STATE_ON 1
1695c49fd3aSAlan Cox #define PSB_PWR_STATE_OFF 2
1705c49fd3aSAlan Cox
1715c49fd3aSAlan Cox #define PSB_PMPOLICY_NOPM 0
1725c49fd3aSAlan Cox #define PSB_PMPOLICY_CLOCKGATING 1
1735c49fd3aSAlan Cox #define PSB_PMPOLICY_POWERDOWN 2
1745c49fd3aSAlan Cox
1755c49fd3aSAlan Cox #define PSB_PMSTATE_POWERUP 0
1765c49fd3aSAlan Cox #define PSB_PMSTATE_CLOCKGATED 1
1775c49fd3aSAlan Cox #define PSB_PMSTATE_POWERDOWN 2
1785c49fd3aSAlan Cox #define PSB_PCIx_MSI_ADDR_LOC 0x94
1795c49fd3aSAlan Cox #define PSB_PCIx_MSI_DATA_LOC 0x98
1805c49fd3aSAlan Cox
1815c49fd3aSAlan Cox /* Medfield crystal settings */
1825c49fd3aSAlan Cox #define KSEL_CRYSTAL_19 1
1835c49fd3aSAlan Cox #define KSEL_BYPASS_19 5
1845c49fd3aSAlan Cox #define KSEL_BYPASS_25 6
1855c49fd3aSAlan Cox #define KSEL_BYPASS_83_100 7
1865c49fd3aSAlan Cox
1875c49fd3aSAlan Cox struct opregion_header;
1885c49fd3aSAlan Cox struct opregion_acpi;
1895c49fd3aSAlan Cox struct opregion_swsci;
1905c49fd3aSAlan Cox struct opregion_asle;
1915c49fd3aSAlan Cox
1925c49fd3aSAlan Cox struct psb_intel_opregion {
1935c49fd3aSAlan Cox struct opregion_header *header;
1945c49fd3aSAlan Cox struct opregion_acpi *acpi;
1955c49fd3aSAlan Cox struct opregion_swsci *swsci;
1965c49fd3aSAlan Cox struct opregion_asle *asle;
1971fb28e9eSAlan Cox void *vbt;
198d839ede4SAlan Cox u32 __iomem *lid_state;
199778e26deSPatrik Jakobsson struct work_struct asle_work;
2005c49fd3aSAlan Cox };
2015c49fd3aSAlan Cox
2025736995bSPatrik Jakobsson struct sdvo_device_mapping {
2035736995bSPatrik Jakobsson u8 initialized;
2045736995bSPatrik Jakobsson u8 dvo_port;
205*0c3f3a83SEaswar Hariharan u8 target_addr;
2065736995bSPatrik Jakobsson u8 dvo_wiring;
2075736995bSPatrik Jakobsson u8 i2c_pin;
2085736995bSPatrik Jakobsson u8 i2c_speed;
2095736995bSPatrik Jakobsson u8 ddc_pin;
2105736995bSPatrik Jakobsson };
2115736995bSPatrik Jakobsson
2125c0c1d50SPatrik Jakobsson struct intel_gmbus {
2135c0c1d50SPatrik Jakobsson struct i2c_adapter adapter;
2145c0c1d50SPatrik Jakobsson struct i2c_adapter *force_bit;
2155c0c1d50SPatrik Jakobsson u32 reg0;
2165c0c1d50SPatrik Jakobsson };
2175c0c1d50SPatrik Jakobsson
2189083eb38SArthur Borsboom /* Register offset maps */
2198512e074SAlan Cox struct psb_offset {
2208512e074SAlan Cox u32 fp0;
2218512e074SAlan Cox u32 fp1;
2228512e074SAlan Cox u32 cntr;
2238512e074SAlan Cox u32 conf;
2248512e074SAlan Cox u32 src;
2258512e074SAlan Cox u32 dpll;
2268512e074SAlan Cox u32 dpll_md;
2278512e074SAlan Cox u32 htotal;
2288512e074SAlan Cox u32 hblank;
2298512e074SAlan Cox u32 hsync;
2308512e074SAlan Cox u32 vtotal;
2318512e074SAlan Cox u32 vblank;
2328512e074SAlan Cox u32 vsync;
2338512e074SAlan Cox u32 stride;
2348512e074SAlan Cox u32 size;
2358512e074SAlan Cox u32 pos;
2368512e074SAlan Cox u32 surf;
2378512e074SAlan Cox u32 addr;
2388512e074SAlan Cox u32 base;
2398512e074SAlan Cox u32 status;
2408512e074SAlan Cox u32 linoff;
2418512e074SAlan Cox u32 tileoff;
2428512e074SAlan Cox u32 palette;
2438512e074SAlan Cox };
2448512e074SAlan Cox
2458512e074SAlan Cox /*
246648a8e34SAlan Cox * Register save state. This is used to hold the context when the
247648a8e34SAlan Cox * device is powered off. In the case of Oaktrail this can (but does not
248648a8e34SAlan Cox * yet) include screen blank. Operations occuring during the save
249648a8e34SAlan Cox * update the register cache instead.
250648a8e34SAlan Cox */
2516256304bSAlan Cox
2529083eb38SArthur Borsboom /* Common status for pipes */
2536256304bSAlan Cox struct psb_pipe {
2546256304bSAlan Cox u32 fp0;
2556256304bSAlan Cox u32 fp1;
2566256304bSAlan Cox u32 cntr;
2576256304bSAlan Cox u32 conf;
2586256304bSAlan Cox u32 src;
2596256304bSAlan Cox u32 dpll;
2606256304bSAlan Cox u32 dpll_md;
2616256304bSAlan Cox u32 htotal;
2626256304bSAlan Cox u32 hblank;
2636256304bSAlan Cox u32 hsync;
2646256304bSAlan Cox u32 vtotal;
2656256304bSAlan Cox u32 vblank;
2666256304bSAlan Cox u32 vsync;
2676256304bSAlan Cox u32 stride;
2686256304bSAlan Cox u32 size;
2696256304bSAlan Cox u32 pos;
2706256304bSAlan Cox u32 base;
2716256304bSAlan Cox u32 surf;
2726256304bSAlan Cox u32 addr;
2736256304bSAlan Cox u32 status;
2746256304bSAlan Cox u32 linoff;
2756256304bSAlan Cox u32 tileoff;
2766256304bSAlan Cox u32 palette[256];
2776256304bSAlan Cox };
2786256304bSAlan Cox
279648a8e34SAlan Cox struct psb_state {
280648a8e34SAlan Cox uint32_t saveVCLK_DIVISOR_VGA0;
281648a8e34SAlan Cox uint32_t saveVCLK_DIVISOR_VGA1;
282648a8e34SAlan Cox uint32_t saveVCLK_POST_DIV;
283648a8e34SAlan Cox uint32_t saveVGACNTRL;
284648a8e34SAlan Cox uint32_t saveADPA;
285648a8e34SAlan Cox uint32_t saveLVDS;
286648a8e34SAlan Cox uint32_t saveDVOA;
287648a8e34SAlan Cox uint32_t saveDVOB;
288648a8e34SAlan Cox uint32_t saveDVOC;
289648a8e34SAlan Cox uint32_t savePP_ON;
290648a8e34SAlan Cox uint32_t savePP_OFF;
291648a8e34SAlan Cox uint32_t savePP_CONTROL;
292648a8e34SAlan Cox uint32_t savePP_CYCLE;
293648a8e34SAlan Cox uint32_t savePFIT_CONTROL;
294648a8e34SAlan Cox uint32_t saveCLOCKGATING;
295648a8e34SAlan Cox uint32_t saveDSPARB;
296648a8e34SAlan Cox uint32_t savePFIT_AUTO_RATIOS;
297648a8e34SAlan Cox uint32_t savePFIT_PGM_RATIOS;
298648a8e34SAlan Cox uint32_t savePP_ON_DELAYS;
299648a8e34SAlan Cox uint32_t savePP_OFF_DELAYS;
300648a8e34SAlan Cox uint32_t savePP_DIVISOR;
301648a8e34SAlan Cox uint32_t saveBCLRPAT_A;
302648a8e34SAlan Cox uint32_t saveBCLRPAT_B;
303648a8e34SAlan Cox uint32_t savePERF_MODE;
304648a8e34SAlan Cox uint32_t saveDSPFW1;
305648a8e34SAlan Cox uint32_t saveDSPFW2;
306648a8e34SAlan Cox uint32_t saveDSPFW3;
307648a8e34SAlan Cox uint32_t saveDSPFW4;
308648a8e34SAlan Cox uint32_t saveDSPFW5;
309648a8e34SAlan Cox uint32_t saveDSPFW6;
310648a8e34SAlan Cox uint32_t saveCHICKENBIT;
311648a8e34SAlan Cox uint32_t saveDSPACURSOR_CTRL;
312648a8e34SAlan Cox uint32_t saveDSPBCURSOR_CTRL;
313648a8e34SAlan Cox uint32_t saveDSPACURSOR_BASE;
314648a8e34SAlan Cox uint32_t saveDSPBCURSOR_BASE;
315648a8e34SAlan Cox uint32_t saveDSPACURSOR_POS;
316648a8e34SAlan Cox uint32_t saveDSPBCURSOR_POS;
317648a8e34SAlan Cox uint32_t saveOV_OVADD;
318648a8e34SAlan Cox uint32_t saveOV_OGAMC0;
319648a8e34SAlan Cox uint32_t saveOV_OGAMC1;
320648a8e34SAlan Cox uint32_t saveOV_OGAMC2;
321648a8e34SAlan Cox uint32_t saveOV_OGAMC3;
322648a8e34SAlan Cox uint32_t saveOV_OGAMC4;
323648a8e34SAlan Cox uint32_t saveOV_OGAMC5;
324648a8e34SAlan Cox uint32_t saveOVC_OVADD;
325648a8e34SAlan Cox uint32_t saveOVC_OGAMC0;
326648a8e34SAlan Cox uint32_t saveOVC_OGAMC1;
327648a8e34SAlan Cox uint32_t saveOVC_OGAMC2;
328648a8e34SAlan Cox uint32_t saveOVC_OGAMC3;
329648a8e34SAlan Cox uint32_t saveOVC_OGAMC4;
330648a8e34SAlan Cox uint32_t saveOVC_OGAMC5;
331648a8e34SAlan Cox
332648a8e34SAlan Cox /* DPST register save */
333648a8e34SAlan Cox uint32_t saveHISTOGRAM_INT_CONTROL_REG;
334648a8e34SAlan Cox uint32_t saveHISTOGRAM_LOGIC_CONTROL_REG;
335648a8e34SAlan Cox uint32_t savePWM_CONTROL_LOGIC;
336648a8e34SAlan Cox };
337648a8e34SAlan Cox
33809016a11SAlan Cox struct cdv_state {
33909016a11SAlan Cox uint32_t saveDSPCLK_GATE_D;
34009016a11SAlan Cox uint32_t saveRAMCLK_GATE_D;
34109016a11SAlan Cox uint32_t saveDSPARB;
34209016a11SAlan Cox uint32_t saveDSPFW[6];
34309016a11SAlan Cox uint32_t saveADPA;
34409016a11SAlan Cox uint32_t savePP_CONTROL;
34509016a11SAlan Cox uint32_t savePFIT_PGM_RATIOS;
34609016a11SAlan Cox uint32_t saveLVDS;
34709016a11SAlan Cox uint32_t savePFIT_CONTROL;
34809016a11SAlan Cox uint32_t savePP_ON_DELAYS;
34909016a11SAlan Cox uint32_t savePP_OFF_DELAYS;
35009016a11SAlan Cox uint32_t savePP_CYCLE;
35109016a11SAlan Cox uint32_t saveVGACNTRL;
35209016a11SAlan Cox uint32_t saveIER;
35309016a11SAlan Cox uint32_t saveIMR;
35409016a11SAlan Cox u8 saveLBB;
35509016a11SAlan Cox };
35609016a11SAlan Cox
357c6265ff5SAlan Cox struct psb_save_area {
3586256304bSAlan Cox struct psb_pipe pipe[3];
359c6265ff5SAlan Cox uint32_t saveBSM;
360c6265ff5SAlan Cox uint32_t saveVBT;
361c6265ff5SAlan Cox union {
362c6265ff5SAlan Cox struct psb_state psb;
36309016a11SAlan Cox struct cdv_state cdv;
364c6265ff5SAlan Cox };
365c6265ff5SAlan Cox uint32_t saveBLC_PWM_CTL2;
366c6265ff5SAlan Cox uint32_t saveBLC_PWM_CTL;
367c6265ff5SAlan Cox };
368c6265ff5SAlan Cox
3695c49fd3aSAlan Cox struct psb_ops;
3705c49fd3aSAlan Cox
37104bd564fSAlan Cox #define PSB_NUM_PIPE 3
37204bd564fSAlan Cox
373bfc838f8SAndy Shevchenko struct intel_scu_ipc_dev;
374bfc838f8SAndy Shevchenko
3755c49fd3aSAlan Cox struct drm_psb_private {
376c2f17e60SThomas Zimmermann struct drm_device dev;
377c2f17e60SThomas Zimmermann
3782657929dSPatrik Jakobsson struct pci_dev *aux_pdev; /* Currently only used by mrst */
3795a52b1f2SJan Safrata struct pci_dev *lpc_pdev; /* Currently only used by mrst */
3805c49fd3aSAlan Cox const struct psb_ops *ops;
3818512e074SAlan Cox const struct psb_offset *regmap;
3825c49fd3aSAlan Cox
3831fb28e9eSAlan Cox struct child_device_config *child_dev;
3841fb28e9eSAlan Cox int child_dev_num;
3851fb28e9eSAlan Cox
3865c49fd3aSAlan Cox struct psb_gtt gtt;
3875c49fd3aSAlan Cox
3885c49fd3aSAlan Cox /* GTT Memory manager */
3895c49fd3aSAlan Cox struct psb_gtt_mm *gtt_mm;
3905c49fd3aSAlan Cox struct page *scratch_page;
391eab37607SKirill A. Shutemov u32 __iomem *gtt_map;
3925c49fd3aSAlan Cox uint32_t stolen_base;
39337214ca0SKirill A. Shutemov u8 __iomem *vram_addr;
3945c49fd3aSAlan Cox unsigned long vram_stolen_size;
3955c49fd3aSAlan Cox u16 gmch_ctrl; /* Saved GTT setup */
3965c49fd3aSAlan Cox u32 pge_ctl;
3975c49fd3aSAlan Cox
3985c49fd3aSAlan Cox struct mutex gtt_mutex;
3995c49fd3aSAlan Cox struct resource *gtt_mem; /* Our PCI resource */
4005c49fd3aSAlan Cox
401737292a3SDaniel Vetter struct mutex mmap_mutex;
402737292a3SDaniel Vetter
4035c49fd3aSAlan Cox struct psb_mmu_driver *mmu;
4045c49fd3aSAlan Cox struct psb_mmu_pd *pf_pd;
4055c49fd3aSAlan Cox
4069083eb38SArthur Borsboom /* Register base */
407846a6038SKirill A. Shutemov uint8_t __iomem *sgx_reg;
408846a6038SKirill A. Shutemov uint8_t __iomem *vdc_reg;
4092657929dSPatrik Jakobsson uint8_t __iomem *aux_reg; /* Auxillary vdc pipe regs */
4105a52b1f2SJan Safrata uint16_t lpc_gpio_base;
4115c49fd3aSAlan Cox uint32_t gatt_free_offset;
4125c49fd3aSAlan Cox
4139083eb38SArthur Borsboom /* Fencing / irq */
4145c49fd3aSAlan Cox uint32_t vdc_irq_mask;
4155c49fd3aSAlan Cox uint32_t pipestat[PSB_NUM_PIPE];
4165c49fd3aSAlan Cox
4175c49fd3aSAlan Cox spinlock_t irqmask_lock;
418da596080SSui Jingfeng bool irq_enabled;
4195c49fd3aSAlan Cox
4209083eb38SArthur Borsboom /* Power */
421672c4735SHans de Goede bool pm_initialized;
4225c49fd3aSAlan Cox
4239083eb38SArthur Borsboom /* Modesetting */
4245c49fd3aSAlan Cox struct psb_intel_mode_device mode_dev;
4254ab2c7f1SAlan Cox bool modeset; /* true if we have done the mode_device setup */
4265c49fd3aSAlan Cox
4275c49fd3aSAlan Cox struct drm_crtc *plane_to_crtc_mapping[PSB_NUM_PIPE];
4285c49fd3aSAlan Cox struct drm_crtc *pipe_to_crtc_mapping[PSB_NUM_PIPE];
4295c49fd3aSAlan Cox uint32_t num_pipe;
4305c49fd3aSAlan Cox
4319083eb38SArthur Borsboom /* OSPM info (Power management base) (TODO: can go ?) */
4325c49fd3aSAlan Cox uint32_t ospm_base;
4335c49fd3aSAlan Cox
4349083eb38SArthur Borsboom /* Sizes info */
4355c49fd3aSAlan Cox u32 fuse_reg_value;
4365c49fd3aSAlan Cox u32 video_device_fuse;
4375c49fd3aSAlan Cox
4385c49fd3aSAlan Cox /* PCI revision ID for B0:D2:F0 */
4395c49fd3aSAlan Cox uint8_t platform_rev_id;
4405c49fd3aSAlan Cox
4415c0c1d50SPatrik Jakobsson /* gmbus */
4425c0c1d50SPatrik Jakobsson struct intel_gmbus *gmbus;
4432657929dSPatrik Jakobsson uint8_t __iomem *gmbus_reg;
4445c0c1d50SPatrik Jakobsson
4455736995bSPatrik Jakobsson /* Used by SDVO */
4465736995bSPatrik Jakobsson int crt_ddc_pin;
4475736995bSPatrik Jakobsson /* FIXME: The mappings should be parsed from bios but for now we can
4485736995bSPatrik Jakobsson pretend there are no mappings available */
4495736995bSPatrik Jakobsson struct sdvo_device_mapping sdvo_mappings[2];
4505736995bSPatrik Jakobsson u32 hotplug_supported_mask;
4515736995bSPatrik Jakobsson struct drm_property *broadcast_rgb_property;
4525736995bSPatrik Jakobsson struct drm_property *force_audio_property;
4535736995bSPatrik Jakobsson
4549083eb38SArthur Borsboom /* LVDS info */
4555c49fd3aSAlan Cox int backlight_duty_cycle; /* restore backlight to this value */
4565c49fd3aSAlan Cox bool panel_wants_dither;
4575c49fd3aSAlan Cox struct drm_display_mode *panel_fixed_mode;
4585c49fd3aSAlan Cox struct drm_display_mode *lfp_lvds_vbt_mode;
4595c49fd3aSAlan Cox struct drm_display_mode *sdvo_lvds_vbt_mode;
4605c49fd3aSAlan Cox
4615c49fd3aSAlan Cox struct bdb_lvds_backlight *lvds_bl; /* LVDS backlight info from VBT */
46204477e5eSPatrik Jakobsson struct gma_i2c_chan *lvds_i2c_bus; /* FIXME: Remove this? */
4635c49fd3aSAlan Cox
4645c49fd3aSAlan Cox /* Feature bits from the VBIOS */
4655c49fd3aSAlan Cox unsigned int int_tv_support:1;
4665c49fd3aSAlan Cox unsigned int lvds_dither:1;
4675c49fd3aSAlan Cox unsigned int lvds_vbt:1;
4685c49fd3aSAlan Cox unsigned int int_crt_support:1;
4695c49fd3aSAlan Cox unsigned int lvds_use_ssc:1;
4705c49fd3aSAlan Cox int lvds_ssc_freq;
4715c49fd3aSAlan Cox bool is_lvds_on;
4725c49fd3aSAlan Cox bool is_mipi_on;
4737c420636SPatrik Jakobsson bool lvds_enabled_in_vbt;
4745c49fd3aSAlan Cox u32 mipi_ctrl_display;
4755c49fd3aSAlan Cox
4765c49fd3aSAlan Cox unsigned int core_freq;
4775c49fd3aSAlan Cox uint32_t iLVDS_enable;
4785c49fd3aSAlan Cox
4795c49fd3aSAlan Cox /* MID specific */
4809b6a1657SHans de Goede bool use_msi;
4814086b1e2SKirill A. Shutemov bool has_gct;
4825c49fd3aSAlan Cox struct oaktrail_gct_data gct_data;
4835c49fd3aSAlan Cox
484933315acSAlan Cox /* Oaktrail HDMI state */
4855c49fd3aSAlan Cox struct oaktrail_hdmi_dev *hdmi_priv;
4865c49fd3aSAlan Cox
4879083eb38SArthur Borsboom /* Register state */
488c6265ff5SAlan Cox struct psb_save_area regs;
489c6265ff5SAlan Cox
4909083eb38SArthur Borsboom /* Hotplug handling */
491ae0a246aSAlan Cox struct work_struct hotplug_work;
4925c49fd3aSAlan Cox
4935c49fd3aSAlan Cox struct psb_intel_opregion opregion;
4945c49fd3aSAlan Cox
4959083eb38SArthur Borsboom /* Watchdog */
4965c49fd3aSAlan Cox uint32_t apm_reg;
4975c49fd3aSAlan Cox uint16_t apm_base;
4985c49fd3aSAlan Cox
4995c49fd3aSAlan Cox /*
5005c49fd3aSAlan Cox * Used for modifying backlight from
5015c49fd3aSAlan Cox * xrandr -- consider removing and using HAL instead
5025c49fd3aSAlan Cox */
503bfc838f8SAndy Shevchenko struct intel_scu_ipc_dev *scu;
5045c49fd3aSAlan Cox struct backlight_device *backlight_device;
5055c49fd3aSAlan Cox struct drm_property *backlight_property;
506d112a816SZhao Yakui bool backlight_enabled;
507d112a816SZhao Yakui int backlight_level;
5085c49fd3aSAlan Cox uint32_t blc_adj1;
5095c49fd3aSAlan Cox uint32_t blc_adj2;
5105c49fd3aSAlan Cox
511026abc33SKirill A. Shutemov bool dsr_enable;
512026abc33SKirill A. Shutemov u32 dsr_fb_update;
513026abc33SKirill A. Shutemov bool dpi_panel_on[3];
514026abc33SKirill A. Shutemov void *dsi_configs[2];
515026abc33SKirill A. Shutemov u32 bpp;
516026abc33SKirill A. Shutemov u32 bpp2;
517026abc33SKirill A. Shutemov
518026abc33SKirill A. Shutemov u32 pipeconf[3];
519026abc33SKirill A. Shutemov u32 dspcntr[3];
520026abc33SKirill A. Shutemov
521642c52fcSAlan Cox bool dplla_96mhz; /* DPLL data from the VBT */
522d112a816SZhao Yakui
523d112a816SZhao Yakui struct {
524d112a816SZhao Yakui int rate;
525d112a816SZhao Yakui int lanes;
526d112a816SZhao Yakui int preemphasis;
527d112a816SZhao Yakui int vswing;
528d112a816SZhao Yakui
529d112a816SZhao Yakui bool initialized;
530d112a816SZhao Yakui bool support;
531d112a816SZhao Yakui int bpp;
532d112a816SZhao Yakui struct edp_power_seq pps;
533d112a816SZhao Yakui } edp;
534d112a816SZhao Yakui uint8_t panel_type;
5355c49fd3aSAlan Cox };
5365c49fd3aSAlan Cox
to_drm_psb_private(struct drm_device * dev)537f71635e8SThomas Zimmermann static inline struct drm_psb_private *to_drm_psb_private(struct drm_device *dev)
538f71635e8SThomas Zimmermann {
539c2f17e60SThomas Zimmermann return container_of(dev, struct drm_psb_private, dev);
540f71635e8SThomas Zimmermann }
5415c49fd3aSAlan Cox
5429083eb38SArthur Borsboom /* Operations for each board type */
5435c49fd3aSAlan Cox struct psb_ops {
5445c49fd3aSAlan Cox const char *name;
5455c49fd3aSAlan Cox int pipes; /* Number of output pipes */
5465c49fd3aSAlan Cox int crtcs; /* Number of CRTCs */
5475c49fd3aSAlan Cox int sgx_offset; /* Base offset of SGX device */
548d235e64aSAlan Cox int hdmi_mask; /* Mask of HDMI CRTCs */
549d235e64aSAlan Cox int lvds_mask; /* Mask of LVDS CRTCs */
550cf8efd3aSPatrik Jakobsson int sdvo_mask; /* Mask of SDVO CRTCs */
551bc794829SPatrik Jakobsson int cursor_needs_phys; /* If cursor base reg need physical address */
5525c49fd3aSAlan Cox
5535c49fd3aSAlan Cox /* Sub functions */
5545c49fd3aSAlan Cox struct drm_crtc_helper_funcs const *crtc_helper;
5555ea75e0fSPatrik Jakobsson const struct gma_clock_funcs *clock_funcs;
5565c49fd3aSAlan Cox
5575c49fd3aSAlan Cox /* Setup hooks */
5585c49fd3aSAlan Cox int (*chip_setup)(struct drm_device *dev);
5595c49fd3aSAlan Cox void (*chip_teardown)(struct drm_device *dev);
560d235e64aSAlan Cox /* Optional helper caller after modeset */
561d235e64aSAlan Cox void (*errata)(struct drm_device *dev);
5625c49fd3aSAlan Cox
5635c49fd3aSAlan Cox /* Display management hooks */
5645c49fd3aSAlan Cox int (*output_init)(struct drm_device *dev);
56568cb638fSAlan Cox int (*hotplug)(struct drm_device *dev);
56668cb638fSAlan Cox void (*hotplug_enable)(struct drm_device *dev, bool on);
5675c49fd3aSAlan Cox /* Power management hooks */
5685c49fd3aSAlan Cox void (*init_pm)(struct drm_device *dev);
5695c49fd3aSAlan Cox int (*save_regs)(struct drm_device *dev);
5705c49fd3aSAlan Cox int (*restore_regs)(struct drm_device *dev);
571d56f57acSDaniel Vetter void (*save_crtc)(struct drm_crtc *crtc);
572d56f57acSDaniel Vetter void (*restore_crtc)(struct drm_crtc *crtc);
5735c49fd3aSAlan Cox int (*power_up)(struct drm_device *dev);
5745c49fd3aSAlan Cox int (*power_down)(struct drm_device *dev);
57528a8194cSPatrik Jakobsson void (*update_wm)(struct drm_device *dev, struct drm_crtc *crtc);
57675346fe9SPatrik Jakobsson void (*disable_sr)(struct drm_device *dev);
5775c49fd3aSAlan Cox
5785c49fd3aSAlan Cox void (*lvds_bl_power)(struct drm_device *dev, bool on);
5791f90b123SHans de Goede
5805c49fd3aSAlan Cox /* Backlight */
5815c49fd3aSAlan Cox int (*backlight_init)(struct drm_device *dev);
5821f90b123SHans de Goede void (*backlight_set)(struct drm_device *dev, int level);
5831f90b123SHans de Goede int (*backlight_get)(struct drm_device *dev);
5841f90b123SHans de Goede const char *backlight_name;
5851f90b123SHans de Goede
5865c49fd3aSAlan Cox int i2c_bus; /* I2C bus identifier for Moorestown */
5875c49fd3aSAlan Cox };
5885c49fd3aSAlan Cox
5895c49fd3aSAlan Cox /* modesetting */
5905c49fd3aSAlan Cox extern void psb_modeset_init(struct drm_device *dev);
5915c49fd3aSAlan Cox extern void psb_modeset_cleanup(struct drm_device *dev);
592b8bbbea1SThomas Zimmermann
593b8bbbea1SThomas Zimmermann /* framebuffer */
594b8bbbea1SThomas Zimmermann struct drm_framebuffer *psb_framebuffer_create(struct drm_device *dev,
595b8bbbea1SThomas Zimmermann const struct drm_mode_fb_cmd2 *mode_cmd,
596b8bbbea1SThomas Zimmermann struct drm_gem_object *obj);
597b8bbbea1SThomas Zimmermann
598b8bbbea1SThomas Zimmermann /* fbdev */
599b8bbbea1SThomas Zimmermann #if defined(CONFIG_DRM_FBDEV_EMULATION)
6008f1aaccbSThomas Zimmermann void psb_fbdev_setup(struct drm_psb_private *dev_priv);
601b8bbbea1SThomas Zimmermann #else
psb_fbdev_setup(struct drm_psb_private * dev_priv)6028f1aaccbSThomas Zimmermann static inline void psb_fbdev_setup(struct drm_psb_private *dev_priv)
603b8bbbea1SThomas Zimmermann { }
604b8bbbea1SThomas Zimmermann #endif
6055c49fd3aSAlan Cox
6065c49fd3aSAlan Cox /* backlight.c */
6075c49fd3aSAlan Cox int gma_backlight_init(struct drm_device *dev);
6085c49fd3aSAlan Cox void gma_backlight_exit(struct drm_device *dev);
609d112a816SZhao Yakui void gma_backlight_disable(struct drm_device *dev);
610d112a816SZhao Yakui void gma_backlight_enable(struct drm_device *dev);
611d112a816SZhao Yakui void gma_backlight_set(struct drm_device *dev, int v);
6125c49fd3aSAlan Cox
6135c49fd3aSAlan Cox /* oaktrail_crtc.c */
6145c49fd3aSAlan Cox extern const struct drm_crtc_helper_funcs oaktrail_helper_funcs;
6155c49fd3aSAlan Cox
6165c49fd3aSAlan Cox /* oaktrail_lvds.c */
6175c49fd3aSAlan Cox extern void oaktrail_lvds_init(struct drm_device *dev,
6185c49fd3aSAlan Cox struct psb_intel_mode_device *mode_dev);
6195c49fd3aSAlan Cox
6205c49fd3aSAlan Cox /* psb_intel_display.c */
6215c49fd3aSAlan Cox extern const struct drm_crtc_helper_funcs psb_intel_helper_funcs;
6225c49fd3aSAlan Cox
6235c49fd3aSAlan Cox /* psb_intel_lvds.c */
6245c49fd3aSAlan Cox extern const struct drm_connector_helper_funcs
6255c49fd3aSAlan Cox psb_intel_lvds_connector_helper_funcs;
6265c49fd3aSAlan Cox extern const struct drm_connector_funcs psb_intel_lvds_connector_funcs;
6275c49fd3aSAlan Cox
6285c49fd3aSAlan Cox /* gem.c */
6295c49fd3aSAlan Cox extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
6305c49fd3aSAlan Cox struct drm_mode_create_dumb *args);
6315c49fd3aSAlan Cox
6325c49fd3aSAlan Cox /* psb_device.c */
6335c49fd3aSAlan Cox extern const struct psb_ops psb_chip_ops;
6345c49fd3aSAlan Cox
6355c49fd3aSAlan Cox /* oaktrail_device.c */
6365c49fd3aSAlan Cox extern const struct psb_ops oaktrail_chip_ops;
6375c49fd3aSAlan Cox
6385c49fd3aSAlan Cox /* cdv_device.c */
6395c49fd3aSAlan Cox extern const struct psb_ops cdv_chip_ops;
6405c49fd3aSAlan Cox
6419083eb38SArthur Borsboom /* Utilities */
REGISTER_READ(struct drm_device * dev,uint32_t reg)6425c49fd3aSAlan Cox static inline uint32_t REGISTER_READ(struct drm_device *dev, uint32_t reg)
6435c49fd3aSAlan Cox {
644f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
6455c49fd3aSAlan Cox return ioread32(dev_priv->vdc_reg + reg);
6465c49fd3aSAlan Cox }
6475c49fd3aSAlan Cox
REGISTER_READ_AUX(struct drm_device * dev,uint32_t reg)6482657929dSPatrik Jakobsson static inline uint32_t REGISTER_READ_AUX(struct drm_device *dev, uint32_t reg)
6492657929dSPatrik Jakobsson {
650f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
6512657929dSPatrik Jakobsson return ioread32(dev_priv->aux_reg + reg);
6522657929dSPatrik Jakobsson }
6532657929dSPatrik Jakobsson
6545c49fd3aSAlan Cox #define REG_READ(reg) REGISTER_READ(dev, (reg))
6552657929dSPatrik Jakobsson #define REG_READ_AUX(reg) REGISTER_READ_AUX(dev, (reg))
6565c49fd3aSAlan Cox
657b97b8287SPatrik Jakobsson /* Useful for post reads */
REGISTER_READ_WITH_AUX(struct drm_device * dev,uint32_t reg,int aux)658b97b8287SPatrik Jakobsson static inline uint32_t REGISTER_READ_WITH_AUX(struct drm_device *dev,
659b97b8287SPatrik Jakobsson uint32_t reg, int aux)
660b97b8287SPatrik Jakobsson {
661b97b8287SPatrik Jakobsson uint32_t val;
662b97b8287SPatrik Jakobsson
663b97b8287SPatrik Jakobsson if (aux)
664b97b8287SPatrik Jakobsson val = REG_READ_AUX(reg);
665b97b8287SPatrik Jakobsson else
666b97b8287SPatrik Jakobsson val = REG_READ(reg);
667b97b8287SPatrik Jakobsson
668b97b8287SPatrik Jakobsson return val;
669b97b8287SPatrik Jakobsson }
670b97b8287SPatrik Jakobsson
671b97b8287SPatrik Jakobsson #define REG_READ_WITH_AUX(reg, aux) REGISTER_READ_WITH_AUX(dev, (reg), (aux))
672b97b8287SPatrik Jakobsson
REGISTER_WRITE(struct drm_device * dev,uint32_t reg,uint32_t val)6735c49fd3aSAlan Cox static inline void REGISTER_WRITE(struct drm_device *dev, uint32_t reg,
6745c49fd3aSAlan Cox uint32_t val)
6755c49fd3aSAlan Cox {
676f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
6775c49fd3aSAlan Cox iowrite32((val), dev_priv->vdc_reg + (reg));
6785c49fd3aSAlan Cox }
6795c49fd3aSAlan Cox
REGISTER_WRITE_AUX(struct drm_device * dev,uint32_t reg,uint32_t val)6802657929dSPatrik Jakobsson static inline void REGISTER_WRITE_AUX(struct drm_device *dev, uint32_t reg,
6812657929dSPatrik Jakobsson uint32_t val)
6822657929dSPatrik Jakobsson {
683f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
6842657929dSPatrik Jakobsson iowrite32((val), dev_priv->aux_reg + (reg));
6852657929dSPatrik Jakobsson }
6862657929dSPatrik Jakobsson
6875c49fd3aSAlan Cox #define REG_WRITE(reg, val) REGISTER_WRITE(dev, (reg), (val))
6882657929dSPatrik Jakobsson #define REG_WRITE_AUX(reg, val) REGISTER_WRITE_AUX(dev, (reg), (val))
6895c49fd3aSAlan Cox
REGISTER_WRITE_WITH_AUX(struct drm_device * dev,uint32_t reg,uint32_t val,int aux)690b97b8287SPatrik Jakobsson static inline void REGISTER_WRITE_WITH_AUX(struct drm_device *dev, uint32_t reg,
691b97b8287SPatrik Jakobsson uint32_t val, int aux)
692b97b8287SPatrik Jakobsson {
693b97b8287SPatrik Jakobsson if (aux)
694b97b8287SPatrik Jakobsson REG_WRITE_AUX(reg, val);
695b97b8287SPatrik Jakobsson else
696b97b8287SPatrik Jakobsson REG_WRITE(reg, val);
697b97b8287SPatrik Jakobsson }
698b97b8287SPatrik Jakobsson
699b97b8287SPatrik Jakobsson #define REG_WRITE_WITH_AUX(reg, val, aux) REGISTER_WRITE_WITH_AUX(dev, (reg), (val), (aux))
700b97b8287SPatrik Jakobsson
REGISTER_WRITE16(struct drm_device * dev,uint32_t reg,uint32_t val)7015c49fd3aSAlan Cox static inline void REGISTER_WRITE16(struct drm_device *dev,
7025c49fd3aSAlan Cox uint32_t reg, uint32_t val)
7035c49fd3aSAlan Cox {
704f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
7055c49fd3aSAlan Cox iowrite16((val), dev_priv->vdc_reg + (reg));
7065c49fd3aSAlan Cox }
7075c49fd3aSAlan Cox
7085c49fd3aSAlan Cox #define REG_WRITE16(reg, val) REGISTER_WRITE16(dev, (reg), (val))
7095c49fd3aSAlan Cox
REGISTER_WRITE8(struct drm_device * dev,uint32_t reg,uint32_t val)7105c49fd3aSAlan Cox static inline void REGISTER_WRITE8(struct drm_device *dev,
7115c49fd3aSAlan Cox uint32_t reg, uint32_t val)
7125c49fd3aSAlan Cox {
713f71635e8SThomas Zimmermann struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
7145c49fd3aSAlan Cox iowrite8((val), dev_priv->vdc_reg + (reg));
7155c49fd3aSAlan Cox }
7165c49fd3aSAlan Cox
7175c49fd3aSAlan Cox #define REG_WRITE8(reg, val) REGISTER_WRITE8(dev, (reg), (val))
7185c49fd3aSAlan Cox
7195c49fd3aSAlan Cox #define PSB_WVDC32(_val, _offs) iowrite32(_val, dev_priv->vdc_reg + (_offs))
7205c49fd3aSAlan Cox #define PSB_RVDC32(_offs) ioread32(dev_priv->vdc_reg + (_offs))
7215c49fd3aSAlan Cox
7225c49fd3aSAlan Cox #define PSB_RSGX32(_offs) ioread32(dev_priv->sgx_reg + (_offs))
7235c49fd3aSAlan Cox #define PSB_WSGX32(_val, _offs) iowrite32(_val, dev_priv->sgx_reg + (_offs))
7245c49fd3aSAlan Cox
7255c49fd3aSAlan Cox #define PSB_WMSVDX32(_val, _offs) iowrite32(_val, dev_priv->msvdx_reg + (_offs))
7265c49fd3aSAlan Cox #define PSB_RMSVDX32(_offs) ioread32(dev_priv->msvdx_reg + (_offs))
7275c49fd3aSAlan Cox
7285c49fd3aSAlan Cox #endif
729