18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ATI Frame Buffer Device Driver Core Definitions 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 78c2ecf20Sopenharmony_ci#include <linux/wait.h> 88c2ecf20Sopenharmony_ci /* 98c2ecf20Sopenharmony_ci * Elements of the hardware specific atyfb_par structure 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cistruct crtc { 138c2ecf20Sopenharmony_ci u32 vxres; 148c2ecf20Sopenharmony_ci u32 vyres; 158c2ecf20Sopenharmony_ci u32 xoffset; 168c2ecf20Sopenharmony_ci u32 yoffset; 178c2ecf20Sopenharmony_ci u32 bpp; 188c2ecf20Sopenharmony_ci u32 h_tot_disp; 198c2ecf20Sopenharmony_ci u32 h_sync_strt_wid; 208c2ecf20Sopenharmony_ci u32 v_tot_disp; 218c2ecf20Sopenharmony_ci u32 v_sync_strt_wid; 228c2ecf20Sopenharmony_ci u32 vline_crnt_vline; 238c2ecf20Sopenharmony_ci u32 off_pitch; 248c2ecf20Sopenharmony_ci u32 gen_cntl; 258c2ecf20Sopenharmony_ci u32 dp_pix_width; /* acceleration */ 268c2ecf20Sopenharmony_ci u32 dp_chain_mask; /* acceleration */ 278c2ecf20Sopenharmony_ci#ifdef CONFIG_FB_ATY_GENERIC_LCD 288c2ecf20Sopenharmony_ci u32 horz_stretching; 298c2ecf20Sopenharmony_ci u32 vert_stretching; 308c2ecf20Sopenharmony_ci u32 ext_vert_stretch; 318c2ecf20Sopenharmony_ci u32 shadow_h_tot_disp; 328c2ecf20Sopenharmony_ci u32 shadow_h_sync_strt_wid; 338c2ecf20Sopenharmony_ci u32 shadow_v_tot_disp; 348c2ecf20Sopenharmony_ci u32 shadow_v_sync_strt_wid; 358c2ecf20Sopenharmony_ci u32 lcd_gen_cntl; 368c2ecf20Sopenharmony_ci u32 lcd_config_panel; 378c2ecf20Sopenharmony_ci u32 lcd_index; 388c2ecf20Sopenharmony_ci#endif 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct aty_interrupt { 428c2ecf20Sopenharmony_ci wait_queue_head_t wait; 438c2ecf20Sopenharmony_ci unsigned int count; 448c2ecf20Sopenharmony_ci int pan_display; 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct pll_info { 488c2ecf20Sopenharmony_ci int pll_max; 498c2ecf20Sopenharmony_ci int pll_min; 508c2ecf20Sopenharmony_ci int sclk, mclk, mclk_pm, xclk; 518c2ecf20Sopenharmony_ci int ref_div; 528c2ecf20Sopenharmony_ci int ref_clk; 538c2ecf20Sopenharmony_ci int ecp_max; 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_citypedef struct { 578c2ecf20Sopenharmony_ci u16 unknown1; 588c2ecf20Sopenharmony_ci u16 PCLK_min_freq; 598c2ecf20Sopenharmony_ci u16 PCLK_max_freq; 608c2ecf20Sopenharmony_ci u16 unknown2; 618c2ecf20Sopenharmony_ci u16 ref_freq; 628c2ecf20Sopenharmony_ci u16 ref_divider; 638c2ecf20Sopenharmony_ci u16 unknown3; 648c2ecf20Sopenharmony_ci u16 MCLK_pwd; 658c2ecf20Sopenharmony_ci u16 MCLK_max_freq; 668c2ecf20Sopenharmony_ci u16 XCLK_max_freq; 678c2ecf20Sopenharmony_ci u16 SCLK_freq; 688c2ecf20Sopenharmony_ci} __attribute__ ((packed)) PLL_BLOCK_MACH64; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistruct pll_514 { 718c2ecf20Sopenharmony_ci u8 m; 728c2ecf20Sopenharmony_ci u8 n; 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct pll_18818 { 768c2ecf20Sopenharmony_ci u32 program_bits; 778c2ecf20Sopenharmony_ci u32 locationAddr; 788c2ecf20Sopenharmony_ci u32 period_in_ps; 798c2ecf20Sopenharmony_ci u32 post_divider; 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistruct pll_ct { 838c2ecf20Sopenharmony_ci u8 pll_ref_div; 848c2ecf20Sopenharmony_ci u8 pll_gen_cntl; 858c2ecf20Sopenharmony_ci u8 mclk_fb_div; 868c2ecf20Sopenharmony_ci u8 mclk_fb_mult; /* 2 ro 4 */ 878c2ecf20Sopenharmony_ci u8 sclk_fb_div; 888c2ecf20Sopenharmony_ci u8 pll_vclk_cntl; 898c2ecf20Sopenharmony_ci u8 vclk_post_div; 908c2ecf20Sopenharmony_ci u8 vclk_fb_div; 918c2ecf20Sopenharmony_ci u8 pll_ext_cntl; 928c2ecf20Sopenharmony_ci u8 ext_vpll_cntl; 938c2ecf20Sopenharmony_ci u8 spll_cntl2; 948c2ecf20Sopenharmony_ci u32 dsp_config; /* Mach64 GTB DSP */ 958c2ecf20Sopenharmony_ci u32 dsp_on_off; /* Mach64 GTB DSP */ 968c2ecf20Sopenharmony_ci u32 dsp_loop_latency; 978c2ecf20Sopenharmony_ci u32 fifo_size; 988c2ecf20Sopenharmony_ci u32 xclkpagefaultdelay; 998c2ecf20Sopenharmony_ci u32 xclkmaxrasdelay; 1008c2ecf20Sopenharmony_ci u8 xclk_ref_div; 1018c2ecf20Sopenharmony_ci u8 xclk_post_div; 1028c2ecf20Sopenharmony_ci u8 mclk_post_div_real; 1038c2ecf20Sopenharmony_ci u8 xclk_post_div_real; 1048c2ecf20Sopenharmony_ci u8 vclk_post_div_real; 1058c2ecf20Sopenharmony_ci u8 features; 1068c2ecf20Sopenharmony_ci#ifdef CONFIG_FB_ATY_GENERIC_LCD 1078c2ecf20Sopenharmony_ci u32 xres; /* use for LCD stretching/scaling */ 1088c2ecf20Sopenharmony_ci#endif 1098c2ecf20Sopenharmony_ci}; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* 1128c2ecf20Sopenharmony_ci for pll_ct.features 1138c2ecf20Sopenharmony_ci*/ 1148c2ecf20Sopenharmony_ci#define DONT_USE_SPLL 0x1 1158c2ecf20Sopenharmony_ci#define DONT_USE_XDLL 0x2 1168c2ecf20Sopenharmony_ci#define USE_CPUCLK 0x4 1178c2ecf20Sopenharmony_ci#define POWERDOWN_PLL 0x8 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciunion aty_pll { 1208c2ecf20Sopenharmony_ci struct pll_ct ct; 1218c2ecf20Sopenharmony_ci struct pll_514 ibm514; 1228c2ecf20Sopenharmony_ci struct pll_18818 ics2595; 1238c2ecf20Sopenharmony_ci}; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci /* 1268c2ecf20Sopenharmony_ci * The hardware parameters for each card 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistruct atyfb_par { 1308c2ecf20Sopenharmony_ci u32 pseudo_palette[16]; 1318c2ecf20Sopenharmony_ci struct { u8 red, green, blue; } palette[256]; 1328c2ecf20Sopenharmony_ci const struct aty_dac_ops *dac_ops; 1338c2ecf20Sopenharmony_ci const struct aty_pll_ops *pll_ops; 1348c2ecf20Sopenharmony_ci void __iomem *ati_regbase; 1358c2ecf20Sopenharmony_ci unsigned long clk_wr_offset; /* meaning overloaded, clock id by CT */ 1368c2ecf20Sopenharmony_ci struct crtc crtc; 1378c2ecf20Sopenharmony_ci union aty_pll pll; 1388c2ecf20Sopenharmony_ci struct pll_info pll_limits; 1398c2ecf20Sopenharmony_ci u32 features; 1408c2ecf20Sopenharmony_ci u32 ref_clk_per; 1418c2ecf20Sopenharmony_ci u32 pll_per; 1428c2ecf20Sopenharmony_ci u32 mclk_per; 1438c2ecf20Sopenharmony_ci u32 xclk_per; 1448c2ecf20Sopenharmony_ci u8 bus_type; 1458c2ecf20Sopenharmony_ci u8 ram_type; 1468c2ecf20Sopenharmony_ci u8 mem_refresh_rate; 1478c2ecf20Sopenharmony_ci u16 pci_id; 1488c2ecf20Sopenharmony_ci u32 accel_flags; 1498c2ecf20Sopenharmony_ci int blitter_may_be_busy; 1508c2ecf20Sopenharmony_ci unsigned fifo_space; 1518c2ecf20Sopenharmony_ci int asleep; 1528c2ecf20Sopenharmony_ci int lock_blank; 1538c2ecf20Sopenharmony_ci unsigned long res_start; 1548c2ecf20Sopenharmony_ci unsigned long res_size; 1558c2ecf20Sopenharmony_ci struct pci_dev *pdev; 1568c2ecf20Sopenharmony_ci#ifdef __sparc__ 1578c2ecf20Sopenharmony_ci struct pci_mmap_map *mmap_map; 1588c2ecf20Sopenharmony_ci u8 mmaped; 1598c2ecf20Sopenharmony_ci#endif 1608c2ecf20Sopenharmony_ci int open; 1618c2ecf20Sopenharmony_ci#ifdef CONFIG_FB_ATY_GENERIC_LCD 1628c2ecf20Sopenharmony_ci unsigned long bios_base_phys; 1638c2ecf20Sopenharmony_ci unsigned long bios_base; 1648c2ecf20Sopenharmony_ci unsigned long lcd_table; 1658c2ecf20Sopenharmony_ci u16 lcd_width; 1668c2ecf20Sopenharmony_ci u16 lcd_height; 1678c2ecf20Sopenharmony_ci u32 lcd_pixclock; 1688c2ecf20Sopenharmony_ci u16 lcd_refreshrate; 1698c2ecf20Sopenharmony_ci u16 lcd_htotal; 1708c2ecf20Sopenharmony_ci u16 lcd_hdisp; 1718c2ecf20Sopenharmony_ci u16 lcd_hsync_dly; 1728c2ecf20Sopenharmony_ci u16 lcd_hsync_len; 1738c2ecf20Sopenharmony_ci u16 lcd_vtotal; 1748c2ecf20Sopenharmony_ci u16 lcd_vdisp; 1758c2ecf20Sopenharmony_ci u16 lcd_vsync_len; 1768c2ecf20Sopenharmony_ci u16 lcd_right_margin; 1778c2ecf20Sopenharmony_ci u16 lcd_lower_margin; 1788c2ecf20Sopenharmony_ci u16 lcd_hblank_len; 1798c2ecf20Sopenharmony_ci u16 lcd_vblank_len; 1808c2ecf20Sopenharmony_ci#endif 1818c2ecf20Sopenharmony_ci unsigned long aux_start; /* auxiliary aperture */ 1828c2ecf20Sopenharmony_ci unsigned long aux_size; 1838c2ecf20Sopenharmony_ci struct aty_interrupt vblank; 1848c2ecf20Sopenharmony_ci unsigned long irq_flags; 1858c2ecf20Sopenharmony_ci unsigned int irq; 1868c2ecf20Sopenharmony_ci spinlock_t int_lock; 1878c2ecf20Sopenharmony_ci int wc_cookie; 1888c2ecf20Sopenharmony_ci u32 mem_cntl; 1898c2ecf20Sopenharmony_ci struct crtc saved_crtc; 1908c2ecf20Sopenharmony_ci union aty_pll saved_pll; 1918c2ecf20Sopenharmony_ci}; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci /* 1948c2ecf20Sopenharmony_ci * ATI Mach64 features 1958c2ecf20Sopenharmony_ci */ 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci#define M64_HAS(feature) ((par)->features & (M64F_##feature)) 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci#define M64F_RESET_3D 0x00000001 2008c2ecf20Sopenharmony_ci#define M64F_MAGIC_FIFO 0x00000002 2018c2ecf20Sopenharmony_ci#define M64F_GTB_DSP 0x00000004 2028c2ecf20Sopenharmony_ci#define M64F_FIFO_32 0x00000008 2038c2ecf20Sopenharmony_ci#define M64F_SDRAM_MAGIC_PLL 0x00000010 2048c2ecf20Sopenharmony_ci#define M64F_MAGIC_POSTDIV 0x00000020 2058c2ecf20Sopenharmony_ci#define M64F_INTEGRATED 0x00000040 2068c2ecf20Sopenharmony_ci#define M64F_CT_BUS 0x00000080 2078c2ecf20Sopenharmony_ci#define M64F_VT_BUS 0x00000100 2088c2ecf20Sopenharmony_ci#define M64F_MOBIL_BUS 0x00000200 2098c2ecf20Sopenharmony_ci#define M64F_GX 0x00000400 2108c2ecf20Sopenharmony_ci#define M64F_CT 0x00000800 2118c2ecf20Sopenharmony_ci#define M64F_VT 0x00001000 2128c2ecf20Sopenharmony_ci#define M64F_GT 0x00002000 2138c2ecf20Sopenharmony_ci#define M64F_MAGIC_VRAM_SIZE 0x00004000 2148c2ecf20Sopenharmony_ci#define M64F_G3_PB_1_1 0x00008000 2158c2ecf20Sopenharmony_ci#define M64F_G3_PB_1024x768 0x00010000 2168c2ecf20Sopenharmony_ci#define M64F_EXTRA_BRIGHT 0x00020000 2178c2ecf20Sopenharmony_ci#define M64F_LT_LCD_REGS 0x00040000 2188c2ecf20Sopenharmony_ci#define M64F_XL_DLL 0x00080000 2198c2ecf20Sopenharmony_ci#define M64F_MFB_FORCE_4 0x00100000 2208c2ecf20Sopenharmony_ci#define M64F_HW_TRIPLE 0x00200000 2218c2ecf20Sopenharmony_ci#define M64F_XL_MEM 0x00400000 2228c2ecf20Sopenharmony_ci /* 2238c2ecf20Sopenharmony_ci * Register access 2248c2ecf20Sopenharmony_ci */ 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_cistatic inline u32 aty_ld_le32(int regindex, const struct atyfb_par *par) 2278c2ecf20Sopenharmony_ci{ 2288c2ecf20Sopenharmony_ci /* Hack for bloc 1, should be cleanly optimized by compiler */ 2298c2ecf20Sopenharmony_ci if (regindex >= 0x400) 2308c2ecf20Sopenharmony_ci regindex -= 0x800; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI 2338c2ecf20Sopenharmony_ci return in_le32(par->ati_regbase + regindex); 2348c2ecf20Sopenharmony_ci#else 2358c2ecf20Sopenharmony_ci return readl(par->ati_regbase + regindex); 2368c2ecf20Sopenharmony_ci#endif 2378c2ecf20Sopenharmony_ci} 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistatic inline void aty_st_le32(int regindex, u32 val, const struct atyfb_par *par) 2408c2ecf20Sopenharmony_ci{ 2418c2ecf20Sopenharmony_ci /* Hack for bloc 1, should be cleanly optimized by compiler */ 2428c2ecf20Sopenharmony_ci if (regindex >= 0x400) 2438c2ecf20Sopenharmony_ci regindex -= 0x800; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI 2468c2ecf20Sopenharmony_ci out_le32(par->ati_regbase + regindex, val); 2478c2ecf20Sopenharmony_ci#else 2488c2ecf20Sopenharmony_ci writel(val, par->ati_regbase + regindex); 2498c2ecf20Sopenharmony_ci#endif 2508c2ecf20Sopenharmony_ci} 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cistatic inline void aty_st_le16(int regindex, u16 val, 2538c2ecf20Sopenharmony_ci const struct atyfb_par *par) 2548c2ecf20Sopenharmony_ci{ 2558c2ecf20Sopenharmony_ci /* Hack for bloc 1, should be cleanly optimized by compiler */ 2568c2ecf20Sopenharmony_ci if (regindex >= 0x400) 2578c2ecf20Sopenharmony_ci regindex -= 0x800; 2588c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI 2598c2ecf20Sopenharmony_ci out_le16(par->ati_regbase + regindex, val); 2608c2ecf20Sopenharmony_ci#else 2618c2ecf20Sopenharmony_ci writel(val, par->ati_regbase + regindex); 2628c2ecf20Sopenharmony_ci#endif 2638c2ecf20Sopenharmony_ci} 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_cistatic inline u8 aty_ld_8(int regindex, const struct atyfb_par *par) 2668c2ecf20Sopenharmony_ci{ 2678c2ecf20Sopenharmony_ci /* Hack for bloc 1, should be cleanly optimized by compiler */ 2688c2ecf20Sopenharmony_ci if (regindex >= 0x400) 2698c2ecf20Sopenharmony_ci regindex -= 0x800; 2708c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI 2718c2ecf20Sopenharmony_ci return in_8(par->ati_regbase + regindex); 2728c2ecf20Sopenharmony_ci#else 2738c2ecf20Sopenharmony_ci return readb(par->ati_regbase + regindex); 2748c2ecf20Sopenharmony_ci#endif 2758c2ecf20Sopenharmony_ci} 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_cistatic inline void aty_st_8(int regindex, u8 val, const struct atyfb_par *par) 2788c2ecf20Sopenharmony_ci{ 2798c2ecf20Sopenharmony_ci /* Hack for bloc 1, should be cleanly optimized by compiler */ 2808c2ecf20Sopenharmony_ci if (regindex >= 0x400) 2818c2ecf20Sopenharmony_ci regindex -= 0x800; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI 2848c2ecf20Sopenharmony_ci out_8(par->ati_regbase + regindex, val); 2858c2ecf20Sopenharmony_ci#else 2868c2ecf20Sopenharmony_ci writeb(val, par->ati_regbase + regindex); 2878c2ecf20Sopenharmony_ci#endif 2888c2ecf20Sopenharmony_ci} 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci#if defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) || \ 2918c2ecf20Sopenharmony_cidefined (CONFIG_FB_ATY_BACKLIGHT) 2928c2ecf20Sopenharmony_ciextern void aty_st_lcd(int index, u32 val, const struct atyfb_par *par); 2938c2ecf20Sopenharmony_ciextern u32 aty_ld_lcd(int index, const struct atyfb_par *par); 2948c2ecf20Sopenharmony_ci#endif 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci /* 2978c2ecf20Sopenharmony_ci * DAC operations 2988c2ecf20Sopenharmony_ci */ 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_cistruct aty_dac_ops { 3018c2ecf20Sopenharmony_ci int (*set_dac) (const struct fb_info * info, 3028c2ecf20Sopenharmony_ci const union aty_pll * pll, u32 bpp, u32 accel); 3038c2ecf20Sopenharmony_ci}; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ciextern const struct aty_dac_ops aty_dac_ibm514; /* IBM RGB514 */ 3068c2ecf20Sopenharmony_ciextern const struct aty_dac_ops aty_dac_ati68860b; /* ATI 68860-B */ 3078c2ecf20Sopenharmony_ciextern const struct aty_dac_ops aty_dac_att21c498; /* AT&T 21C498 */ 3088c2ecf20Sopenharmony_ciextern const struct aty_dac_ops aty_dac_unsupported; /* unsupported */ 3098c2ecf20Sopenharmony_ciextern const struct aty_dac_ops aty_dac_ct; /* Integrated */ 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci /* 3138c2ecf20Sopenharmony_ci * Clock operations 3148c2ecf20Sopenharmony_ci */ 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_cistruct aty_pll_ops { 3178c2ecf20Sopenharmony_ci int (*var_to_pll) (const struct fb_info * info, u32 vclk_per, u32 bpp, union aty_pll * pll); 3188c2ecf20Sopenharmony_ci u32 (*pll_to_var) (const struct fb_info * info, const union aty_pll * pll); 3198c2ecf20Sopenharmony_ci void (*set_pll) (const struct fb_info * info, const union aty_pll * pll); 3208c2ecf20Sopenharmony_ci void (*get_pll) (const struct fb_info *info, union aty_pll * pll); 3218c2ecf20Sopenharmony_ci int (*init_pll) (const struct fb_info * info, union aty_pll * pll); 3228c2ecf20Sopenharmony_ci void (*resume_pll)(const struct fb_info *info, union aty_pll *pll); 3238c2ecf20Sopenharmony_ci}; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_ati18818_1; /* ATI 18818 */ 3268c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_stg1703; /* STG 1703 */ 3278c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_ch8398; /* Chrontel 8398 */ 3288c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_att20c408; /* AT&T 20C408 */ 3298c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_ibm514; /* IBM RGB514 */ 3308c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_unsupported; /* unsupported */ 3318c2ecf20Sopenharmony_ciextern const struct aty_pll_ops aty_pll_ct; /* Integrated */ 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ciextern void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll); 3358c2ecf20Sopenharmony_ciextern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ciextern const u8 aty_postdividers[8]; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci /* 3418c2ecf20Sopenharmony_ci * Hardware cursor support 3428c2ecf20Sopenharmony_ci */ 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ciextern int aty_init_cursor(struct fb_info *info, struct fb_ops *atyfb_ops); 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci /* 3478c2ecf20Sopenharmony_ci * Hardware acceleration 3488c2ecf20Sopenharmony_ci */ 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_cistatic inline void wait_for_fifo(u16 entries, struct atyfb_par *par) 3518c2ecf20Sopenharmony_ci{ 3528c2ecf20Sopenharmony_ci unsigned fifo_space = par->fifo_space; 3538c2ecf20Sopenharmony_ci while (entries > fifo_space) { 3548c2ecf20Sopenharmony_ci fifo_space = 16 - fls(aty_ld_le32(FIFO_STAT, par) & 0xffff); 3558c2ecf20Sopenharmony_ci } 3568c2ecf20Sopenharmony_ci par->fifo_space = fifo_space - entries; 3578c2ecf20Sopenharmony_ci} 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_cistatic inline void wait_for_idle(struct atyfb_par *par) 3608c2ecf20Sopenharmony_ci{ 3618c2ecf20Sopenharmony_ci wait_for_fifo(16, par); 3628c2ecf20Sopenharmony_ci while ((aty_ld_le32(GUI_STAT, par) & 1) != 0); 3638c2ecf20Sopenharmony_ci par->blitter_may_be_busy = 0; 3648c2ecf20Sopenharmony_ci} 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ciextern void aty_reset_engine(struct atyfb_par *par); 3678c2ecf20Sopenharmony_ciextern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_civoid atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 3708c2ecf20Sopenharmony_civoid atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 3718c2ecf20Sopenharmony_civoid atyfb_imageblit(struct fb_info *info, const struct fb_image *image); 3728c2ecf20Sopenharmony_ci 373