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