linux/arch/arm/include/asm/hardware/locomo.h
<<
>>
Prefs
   1/*
   2 * arch/arm/include/asm/hardware/locomo.h
   3 *
   4 * This file contains the definitions for the LoCoMo G/A Chip
   5 *
   6 * (C) Copyright 2004 John Lenz
   7 *
   8 * May be copied or modified under the terms of the GNU General Public
   9 * License.  See linux/COPYING for more information.
  10 *
  11 * Based on sa1111.h
  12 */
  13#ifndef _ASM_ARCH_LOCOMO
  14#define _ASM_ARCH_LOCOMO
  15
  16#define locomo_writel(val,addr) ({ *(volatile u16 *)(addr) = (val); })
  17#define locomo_readl(addr)      (*(volatile u16 *)(addr))
  18
  19/* LOCOMO version */
  20#define LOCOMO_VER      0x00
  21
  22/* Pin status */
  23#define LOCOMO_ST       0x04
  24
  25/* Pin status */
  26#define LOCOMO_C32K     0x08
  27
  28/* Interrupt controller */
  29#define LOCOMO_ICR      0x0C
  30
  31/* MCS decoder for boot selecting */
  32#define LOCOMO_MCSX0    0x10
  33#define LOCOMO_MCSX1    0x14
  34#define LOCOMO_MCSX2    0x18
  35#define LOCOMO_MCSX3    0x1c
  36
  37/* Touch panel controller */
  38#define LOCOMO_ASD      0x20            /* AD start delay */
  39#define LOCOMO_HSD      0x28            /* HSYS delay */
  40#define LOCOMO_HSC      0x2c            /* HSYS period */
  41#define LOCOMO_TADC     0x30            /* tablet ADC clock */
  42
  43
  44/* Long time timer */
  45#define LOCOMO_LTC      0xd8            /* LTC interrupt setting */
  46#define LOCOMO_LTINT    0xdc            /* LTC interrupt */
  47
  48/* DAC control signal for LCD (COMADJ ) */
  49#define LOCOMO_DAC              0xe0
  50/* DAC control */
  51#define LOCOMO_DAC_SCLOEB       0x08    /* SCL pin output data       */
  52#define LOCOMO_DAC_TEST         0x04    /* Test bit                  */
  53#define LOCOMO_DAC_SDA          0x02    /* SDA pin level (read-only) */
  54#define LOCOMO_DAC_SDAOEB       0x01    /* SDA pin output data       */
  55
  56/* SPI interface */
  57#define LOCOMO_SPI      0x60
  58#define LOCOMO_SPIMD    0x00            /* SPI mode setting */
  59#define LOCOMO_SPICT    0x04            /* SPI mode control */
  60#define LOCOMO_SPIST    0x08            /* SPI status */
  61#define LOCOMO_SPI_TEND (1 << 3)        /* Transfer end bit */
  62#define LOCOMO_SPI_REND (1 << 2)        /* Receive end bit */
  63#define LOCOMO_SPI_RFW  (1 << 1)        /* write buffer bit */
  64#define LOCOMO_SPI_RFR  (1)             /* read buffer bit */
  65
  66#define LOCOMO_SPIIS    0x10            /* SPI interrupt status */
  67#define LOCOMO_SPIWE    0x14            /* SPI interrupt status write enable */
  68#define LOCOMO_SPIIE    0x18            /* SPI interrupt enable */
  69#define LOCOMO_SPIIR    0x1c            /* SPI interrupt request */
  70#define LOCOMO_SPITD    0x20            /* SPI transfer data write */
  71#define LOCOMO_SPIRD    0x24            /* SPI receive data read */
  72#define LOCOMO_SPITS    0x28            /* SPI transfer data shift */
  73#define LOCOMO_SPIRS    0x2C            /* SPI receive data shift */
  74
  75/* GPIO */
  76#define LOCOMO_GPD              0x90    /* GPIO direction */
  77#define LOCOMO_GPE              0x94    /* GPIO input enable */
  78#define LOCOMO_GPL              0x98    /* GPIO level */
  79#define LOCOMO_GPO              0x9c    /* GPIO out data setting */
  80#define LOCOMO_GRIE             0xa0    /* GPIO rise detection */
  81#define LOCOMO_GFIE             0xa4    /* GPIO fall detection */
  82#define LOCOMO_GIS              0xa8    /* GPIO edge detection status */
  83#define LOCOMO_GWE              0xac    /* GPIO status write enable */
  84#define LOCOMO_GIE              0xb0    /* GPIO interrupt enable */
  85#define LOCOMO_GIR              0xb4    /* GPIO interrupt request */
  86#define LOCOMO_GPIO(Nb)         (0x01 << (Nb))
  87#define LOCOMO_GPIO_RTS         LOCOMO_GPIO(0)
  88#define LOCOMO_GPIO_CTS         LOCOMO_GPIO(1)
  89#define LOCOMO_GPIO_DSR         LOCOMO_GPIO(2)
  90#define LOCOMO_GPIO_DTR         LOCOMO_GPIO(3)
  91#define LOCOMO_GPIO_LCD_VSHA_ON LOCOMO_GPIO(4)
  92#define LOCOMO_GPIO_LCD_VSHD_ON LOCOMO_GPIO(5)
  93#define LOCOMO_GPIO_LCD_VEE_ON  LOCOMO_GPIO(6)
  94#define LOCOMO_GPIO_LCD_MOD     LOCOMO_GPIO(7)
  95#define LOCOMO_GPIO_DAC_ON      LOCOMO_GPIO(8)
  96#define LOCOMO_GPIO_FL_VR       LOCOMO_GPIO(9)
  97#define LOCOMO_GPIO_DAC_SDATA   LOCOMO_GPIO(10)
  98#define LOCOMO_GPIO_DAC_SCK     LOCOMO_GPIO(11)
  99#define LOCOMO_GPIO_DAC_SLOAD   LOCOMO_GPIO(12)
 100#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
 101#define LOCOMO_GPIO_WRITE_PROT  LOCOMO_GPIO(14)
 102#define LOCOMO_GPIO_CARD_POWER  LOCOMO_GPIO(15)
 103
 104/* Start the definitions of the devices.  Each device has an initial
 105 * base address and a series of offsets from that base address. */
 106
 107/* Keyboard controller */
 108#define LOCOMO_KEYBOARD         0x40
 109#define LOCOMO_KIB              0x00    /* KIB level */
 110#define LOCOMO_KSC              0x04    /* KSTRB control */
 111#define LOCOMO_KCMD             0x08    /* KSTRB command */
 112#define LOCOMO_KIC              0x0c    /* Key interrupt */
 113
 114/* Front light adjustment controller */
 115#define LOCOMO_FRONTLIGHT       0xc8
 116#define LOCOMO_ALS              0x00    /* Adjust light cycle */
 117#define LOCOMO_ALD              0x04    /* Adjust light duty */
 118
 119#define LOCOMO_ALC_EN           0x8000
 120
 121/* Backlight controller: TFT signal */
 122#define LOCOMO_BACKLIGHT        0x38
 123#define LOCOMO_TC               0x00            /* TFT control signal */
 124#define LOCOMO_CPSD             0x04            /* CPS delay */
 125
 126/* Audio controller */
 127#define LOCOMO_AUDIO            0x54
 128#define LOCOMO_ACC              0x00    /* Audio clock */
 129#define LOCOMO_PAIF             0xD0    /* PCM audio interface */
 130/* Audio clock */
 131#define LOCOMO_ACC_XON          0x80
 132#define LOCOMO_ACC_XEN          0x40
 133#define LOCOMO_ACC_XSEL0        0x00
 134#define LOCOMO_ACC_XSEL1        0x20
 135#define LOCOMO_ACC_MCLKEN       0x10
 136#define LOCOMO_ACC_64FSEN       0x08
 137#define LOCOMO_ACC_CLKSEL000    0x00    /* mclk  2 */
 138#define LOCOMO_ACC_CLKSEL001    0x01    /* mclk  3 */
 139#define LOCOMO_ACC_CLKSEL010    0x02    /* mclk  4 */
 140#define LOCOMO_ACC_CLKSEL011    0x03    /* mclk  6 */
 141#define LOCOMO_ACC_CLKSEL100    0x04    /* mclk  8 */
 142#define LOCOMO_ACC_CLKSEL101    0x05    /* mclk 12 */
 143/* PCM audio interface */
 144#define LOCOMO_PAIF_SCINV       0x20
 145#define LOCOMO_PAIF_SCEN        0x10
 146#define LOCOMO_PAIF_LRCRST      0x08
 147#define LOCOMO_PAIF_LRCEVE      0x04
 148#define LOCOMO_PAIF_LRCINV      0x02
 149#define LOCOMO_PAIF_LRCEN       0x01
 150
 151/* LED controller */
 152#define LOCOMO_LED              0xe8
 153#define LOCOMO_LPT0             0x00
 154#define LOCOMO_LPT1             0x04
 155/* LED control */
 156#define LOCOMO_LPT_TOFH         0x80
 157#define LOCOMO_LPT_TOFL         0x08
 158#define LOCOMO_LPT_TOH(TOH)     ((TOH & 0x7) << 4)
 159#define LOCOMO_LPT_TOL(TOL)     ((TOL & 0x7))
 160
 161extern struct bus_type locomo_bus_type;
 162
 163#define LOCOMO_DEVID_KEYBOARD   0
 164#define LOCOMO_DEVID_FRONTLIGHT 1
 165#define LOCOMO_DEVID_BACKLIGHT  2
 166#define LOCOMO_DEVID_AUDIO      3
 167#define LOCOMO_DEVID_LED        4
 168#define LOCOMO_DEVID_UART       5
 169#define LOCOMO_DEVID_SPI        6
 170
 171struct locomo_dev {
 172        struct device   dev;
 173        unsigned int    devid;
 174        unsigned int    irq[1];
 175
 176        void            *mapbase;
 177        unsigned long   length;
 178
 179        u64             dma_mask;
 180};
 181
 182#define LOCOMO_DEV(_d)  container_of((_d), struct locomo_dev, dev)
 183
 184#define locomo_get_drvdata(d)   dev_get_drvdata(&(d)->dev)
 185#define locomo_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, p)
 186
 187struct locomo_driver {
 188        struct device_driver    drv;
 189        unsigned int            devid;
 190        int (*probe)(struct locomo_dev *);
 191        void (*remove)(struct locomo_dev *);
 192};
 193
 194#define LOCOMO_DRV(_d)  container_of((_d), struct locomo_driver, drv)
 195
 196#define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
 197
 198void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
 199
 200int locomo_driver_register(struct locomo_driver *);
 201void locomo_driver_unregister(struct locomo_driver *);
 202
 203/* GPIO control functions */
 204void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir);
 205int locomo_gpio_read_level(struct device *dev, unsigned int bits);
 206int locomo_gpio_read_output(struct device *dev, unsigned int bits);
 207void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
 208
 209/* M62332 control function */
 210void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
 211
 212/* Frontlight control */
 213void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
 214
 215struct locomo_platform_data {
 216        int     irq_base;       /* IRQ base for cascaded on-chip IRQs */
 217};
 218
 219#endif
 220