cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sm501.h (4114B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/* include/linux/sm501.h
      3 *
      4 * Copyright (c) 2006 Simtec Electronics
      5 *	Ben Dooks <ben@simtec.co.uk>
      6 *	Vincent Sanders <vince@simtec.co.uk>
      7*/
      8
      9extern int sm501_unit_power(struct device *dev,
     10			    unsigned int unit, unsigned int to);
     11
     12extern unsigned long sm501_set_clock(struct device *dev,
     13				     int clksrc, unsigned long freq);
     14
     15extern unsigned long sm501_find_clock(struct device *dev,
     16				      int clksrc, unsigned long req_freq);
     17
     18/* sm501_misc_control
     19 *
     20 * Modify the SM501's MISC_CONTROL register
     21*/
     22
     23extern int sm501_misc_control(struct device *dev,
     24			      unsigned long set, unsigned long clear);
     25
     26/* sm501_modify_reg
     27 *
     28 * Modify a register in the SM501 which may be shared with other
     29 * drivers.
     30*/
     31
     32extern unsigned long sm501_modify_reg(struct device *dev,
     33				      unsigned long reg,
     34				      unsigned long set,
     35				      unsigned long clear);
     36
     37
     38/* Platform data definitions */
     39
     40#define SM501FB_FLAG_USE_INIT_MODE	(1<<0)
     41#define SM501FB_FLAG_DISABLE_AT_EXIT	(1<<1)
     42#define SM501FB_FLAG_USE_HWCURSOR	(1<<2)
     43#define SM501FB_FLAG_USE_HWACCEL	(1<<3)
     44#define SM501FB_FLAG_PANEL_NO_FPEN	(1<<4)
     45#define SM501FB_FLAG_PANEL_NO_VBIASEN	(1<<5)
     46#define SM501FB_FLAG_PANEL_INV_FPEN	(1<<6)
     47#define SM501FB_FLAG_PANEL_INV_VBIASEN	(1<<7)
     48
     49struct sm501_platdata_fbsub {
     50	struct fb_videomode	*def_mode;
     51	unsigned int		 def_bpp;
     52	unsigned long		 max_mem;
     53	unsigned int		 flags;
     54};
     55
     56enum sm501_fb_routing {
     57	SM501_FB_OWN		= 0,	/* CRT=>CRT, Panel=>Panel */
     58	SM501_FB_CRT_PANEL	= 1,	/* Panel=>CRT, Panel=>Panel */
     59};
     60
     61/* sm501_platdata_fb flag field bit definitions */
     62
     63#define SM501_FBPD_SWAP_FB_ENDIAN	(1<<0)	/* need to endian swap */
     64
     65/* sm501_platdata_fb
     66 *
     67 * configuration data for the framebuffer driver
     68*/
     69
     70struct sm501_platdata_fb {
     71	enum sm501_fb_routing		 fb_route;
     72	unsigned int			 flags;
     73	struct sm501_platdata_fbsub	*fb_crt;
     74	struct sm501_platdata_fbsub	*fb_pnl;
     75};
     76
     77/* gpio i2c
     78 *
     79 * Note, we have to pass in the bus number, as the number used will be
     80 * passed to the i2c-gpio driver's platform_device.id, subsequently used
     81 * to register the i2c bus.
     82*/
     83
     84struct sm501_platdata_gpio_i2c {
     85	unsigned int		bus_num;
     86	unsigned int		pin_sda;
     87	unsigned int		pin_scl;
     88	int			udelay;
     89	int			timeout;
     90};
     91
     92/* sm501_initdata
     93 *
     94 * use for initialising values that may not have been setup
     95 * before the driver is loaded.
     96*/
     97
     98struct sm501_reg_init {
     99	unsigned long		set;
    100	unsigned long		mask;
    101};
    102
    103#define SM501_USE_USB_HOST	(1<<0)
    104#define SM501_USE_USB_SLAVE	(1<<1)
    105#define SM501_USE_SSP0		(1<<2)
    106#define SM501_USE_SSP1		(1<<3)
    107#define SM501_USE_UART0		(1<<4)
    108#define SM501_USE_UART1		(1<<5)
    109#define SM501_USE_FBACCEL	(1<<6)
    110#define SM501_USE_AC97		(1<<7)
    111#define SM501_USE_I2S		(1<<8)
    112#define SM501_USE_GPIO		(1<<9)
    113
    114#define SM501_USE_ALL		(0xffffffff)
    115
    116struct sm501_initdata {
    117	struct sm501_reg_init	gpio_low;
    118	struct sm501_reg_init	gpio_high;
    119	struct sm501_reg_init	misc_timing;
    120	struct sm501_reg_init	misc_control;
    121
    122	unsigned long		devices;
    123	unsigned long		mclk;		/* non-zero to modify */
    124	unsigned long		m1xclk;		/* non-zero to modify */
    125};
    126
    127/* sm501_init_gpio
    128 *
    129 * default gpio settings
    130*/
    131
    132struct sm501_init_gpio {
    133	struct sm501_reg_init	gpio_data_low;
    134	struct sm501_reg_init	gpio_data_high;
    135	struct sm501_reg_init	gpio_ddr_low;
    136	struct sm501_reg_init	gpio_ddr_high;
    137};
    138
    139#define SM501_FLAG_SUSPEND_OFF		(1<<4)
    140
    141/* sm501_platdata
    142 *
    143 * This is passed with the platform device to allow the board
    144 * to control the behaviour of the SM501 driver(s) which attach
    145 * to the device.
    146 *
    147*/
    148
    149struct sm501_platdata {
    150	struct sm501_initdata		*init;
    151	struct sm501_init_gpio		*init_gpiop;
    152	struct sm501_platdata_fb	*fb;
    153
    154	int				 flags;
    155	int				 gpio_base;
    156
    157	int	(*get_power)(struct device *dev);
    158	int	(*set_power)(struct device *dev, unsigned int on);
    159
    160	struct sm501_platdata_gpio_i2c	*gpio_i2c;
    161	unsigned int			 gpio_i2c_nr;
    162};
    163
    164#if defined(CONFIG_PPC32)
    165#define smc501_readl(addr)		ioread32be((addr))
    166#define smc501_writel(val, addr)	iowrite32be((val), (addr))
    167#else
    168#define smc501_readl(addr)		readl(addr)
    169#define smc501_writel(val, addr)	writel(val, addr)
    170#endif