11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 24baa9922430662431231ac637adedddbb0cfb2d7Russell King * arch/arm/include/asm/hardware/locomo.h 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This file contains the definitions for the LoCoMo G/A Chip 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (C) Copyright 2004 John Lenz 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * May be copied or modified under the terms of the GNU General Public 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * License. See linux/COPYING for more information. 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Based on sa1111.h 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _ASM_ARCH_LOCOMO 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _ASM_ARCH_LOCOMO 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define locomo_writel(val,addr) ({ *(volatile u16 *)(addr) = (val); }) 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define locomo_readl(addr) (*(volatile u16 *)(addr)) 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* LOCOMO version */ 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_VER 0x00 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Pin status */ 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ST 0x04 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Pin status */ 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_C32K 0x08 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Interrupt controller */ 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ICR 0x0C 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* MCS decoder for boot selecting */ 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_MCSX0 0x10 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_MCSX1 0x14 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_MCSX2 0x18 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_MCSX3 0x1c 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Touch panel controller */ 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ASD 0x20 /* AD start delay */ 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_HSD 0x28 /* HSYS delay */ 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_HSC 0x2c /* HSYS period */ 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_TADC 0x30 /* tablet ADC clock */ 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Long time timer */ 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LTC 0xd8 /* LTC interrupt setting */ 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LTINT 0xdc /* LTC interrupt */ 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* DAC control signal for LCD (COMADJ ) */ 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DAC 0xe0 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* DAC control */ 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DAC_SCLOEB 0x08 /* SCL pin output data */ 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DAC_TEST 0x04 /* Test bit */ 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DAC_SDA 0x02 /* SDA pin level (read-only) */ 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */ 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* SPI interface */ 57a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPI 0x60 58a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIMD 0x00 /* SPI mode setting */ 59a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPICT 0x04 /* SPI mode control */ 60a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIST 0x08 /* SPI status */ 612a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */ 622a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_SPI_REND (1 << 2) /* Receive end bit */ 632a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */ 642a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_SPI_RFR (1) /* read buffer bit */ 652a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze 66a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */ 67a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */ 68a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */ 69a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIIR 0x1c /* SPI interrupt request */ 70a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPITD 0x20 /* SPI transfer data write */ 71a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIRD 0x24 /* SPI receive data read */ 72a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */ 73a2025e7f73ae5eab0a25dad88c60aba67e3ae690Dirk Opfer#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */ 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* GPIO */ 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPD 0x90 /* GPIO direction */ 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPE 0x94 /* GPIO input enable */ 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPL 0x98 /* GPIO level */ 792a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_GPO 0x9c /* GPIO out data setting */ 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GRIE 0xa0 /* GPIO rise detection */ 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GFIE 0xa4 /* GPIO fall detection */ 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GIS 0xa8 /* GPIO edge detection status */ 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GWE 0xac /* GPIO status write enable */ 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GIE 0xb0 /* GPIO interrupt enable */ 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GIR 0xb4 /* GPIO interrupt request */ 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO(Nb) (0x01 << (Nb)) 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_RTS LOCOMO_GPIO(0) 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_CTS LOCOMO_GPIO(1) 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DSR LOCOMO_GPIO(2) 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DTR LOCOMO_GPIO(3) 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_LCD_VSHA_ON LOCOMO_GPIO(4) 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_LCD_VSHD_ON LOCOMO_GPIO(5) 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_LCD_VEE_ON LOCOMO_GPIO(6) 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_LCD_MOD LOCOMO_GPIO(7) 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DAC_ON LOCOMO_GPIO(8) 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_FL_VR LOCOMO_GPIO(9) 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10) 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11) 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12) 1002a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13) 1012a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_GPIO_WRITE_PROT LOCOMO_GPIO(14) 1022a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_GPIO_CARD_POWER LOCOMO_GPIO(15) 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Start the definitions of the devices. Each device has an initial 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * base address and a series of offsets from that base address. */ 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Keyboard controller */ 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_KEYBOARD 0x40 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_KIB 0x00 /* KIB level */ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_KSC 0x04 /* KSTRB control */ 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_KCMD 0x08 /* KSTRB command */ 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_KIC 0x0c /* Key interrupt */ 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Front light adjustment controller */ 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_FRONTLIGHT 0xc8 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ALS 0x00 /* Adjust light cycle */ 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ALD 0x04 /* Adjust light duty */ 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 119e4423781850025726b6c4e24ba3d93c7ff9cd826Richard Purdie#define LOCOMO_ALC_EN 0x8000 120e4423781850025726b6c4e24ba3d93c7ff9cd826Richard Purdie 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Backlight controller: TFT signal */ 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_BACKLIGHT 0x38 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_TC 0x00 /* TFT control signal */ 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_CPSD 0x04 /* CPS delay */ 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Audio controller */ 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_AUDIO 0x54 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC 0x00 /* Audio clock */ 1292a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_PAIF 0xD0 /* PCM audio interface */ 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Audio clock */ 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_XON 0x80 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_XEN 0x40 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_XSEL0 0x00 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_XSEL1 0x20 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_MCLKEN 0x10 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_64FSEN 0x08 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL000 0x00 /* mclk 2 */ 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL001 0x01 /* mclk 3 */ 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL010 0x02 /* mclk 4 */ 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL011 0x03 /* mclk 6 */ 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL100 0x04 /* mclk 8 */ 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_ACC_CLKSEL101 0x05 /* mclk 12 */ 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* PCM audio interface */ 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_SCINV 0x20 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_SCEN 0x10 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_LRCRST 0x08 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_LRCEVE 0x04 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_LRCINV 0x02 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_PAIF_LRCEN 0x01 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* LED controller */ 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LED 0xe8 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT0 0x00 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT1 0x04 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* LED control */ 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT_TOFH 0x80 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT_TOFL 0x08 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT_TOH(TOH) ((TOH & 0x7) << 4) 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_LPT_TOL(TOL) ((TOL & 0x7)) 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct bus_type locomo_bus_type; 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_KEYBOARD 0 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_FRONTLIGHT 1 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_BACKLIGHT 2 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_AUDIO 3 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_LED 4 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEVID_UART 5 1692a52efb2cecf78201d61bd4930153bf52e57503bThomas Kunze#define LOCOMO_DEVID_SPI 6 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct locomo_dev { 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct device dev; 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int devid; 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int irq[1]; 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds void *mapbase; 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long length; 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u64 dma_mask; 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DEV(_d) container_of((_d), struct locomo_dev, dev) 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define locomo_get_drvdata(d) dev_get_drvdata(&(d)->dev) 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define locomo_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, p) 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct locomo_driver { 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct device_driver drv; 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int devid; 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int (*probe)(struct locomo_dev *); 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int (*remove)(struct locomo_dev *); 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int (*suspend)(struct locomo_dev *, pm_message_t); 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int (*resume)(struct locomo_dev *); 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DRV(_d) container_of((_d), struct locomo_driver, drv) 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name) 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid locomo_lcd_power(struct locomo_dev *, int, unsigned int); 2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint locomo_driver_register(struct locomo_driver *); 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid locomo_driver_unregister(struct locomo_driver *); 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* GPIO control functions */ 2068d48427ecb0639593ccf14e807479b7873254ccbRichard Purdievoid locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir); 2078d48427ecb0639593ccf14e807479b7873254ccbRichard Purdieint locomo_gpio_read_level(struct device *dev, unsigned int bits); 2088d48427ecb0639593ccf14e807479b7873254ccbRichard Purdieint locomo_gpio_read_output(struct device *dev, unsigned int bits); 2098d48427ecb0639593ccf14e807479b7873254ccbRichard Purdievoid locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set); 2108d48427ecb0639593ccf14e807479b7873254ccbRichard Purdie 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* M62332 control function */ 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel); 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 214e4423781850025726b6c4e24ba3d93c7ff9cd826Richard Purdie/* Frontlight control */ 215e4423781850025726b6c4e24ba3d93c7ff9cd826Richard Purdievoid locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf); 216e4423781850025726b6c4e24ba3d93c7ff9cd826Richard Purdie 217ac609d266e4af4ebf586d610bd76e04dddae0c4cEric Miaostruct locomo_platform_data { 218ac609d266e4af4ebf586d610bd76e04dddae0c4cEric Miao int irq_base; /* IRQ base for cascaded on-chip IRQs */ 219ac609d266e4af4ebf586d610bd76e04dddae0c4cEric Miao}; 220ac609d266e4af4ebf586d610bd76e04dddae0c4cEric Miao 2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 222