Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
uctrl.c File Reference
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/pgtable.h>

Go to the source code of this file.

Data Structures

struct  uctrl_regs
 
struct  ts102_regs
 
struct  uctrl_txn
 
struct  uctrl_status
 
struct  uctrl_driver
 

Macros

#define UCTRL_MINOR   174
 
#define DEBUG   1
 
#define dprintk(x)   printk x
 
#define UCTRL_INTR_TXE_REQ   0x01 /* transmit FIFO empty int req */
 
#define UCTRL_INTR_TXNF_REQ   0x02 /* transmit FIFO not full int req */
 
#define UCTRL_INTR_RXNE_REQ   0x04 /* receive FIFO not empty int req */
 
#define UCTRL_INTR_RXO_REQ   0x08 /* receive FIFO overflow int req */
 
#define UCTRL_INTR_TXE_MSK   0x10 /* transmit FIFO empty mask */
 
#define UCTRL_INTR_TXNF_MSK   0x20 /* transmit FIFO not full mask */
 
#define UCTRL_INTR_RXNE_MSK   0x40 /* receive FIFO not empty mask */
 
#define UCTRL_INTR_RXO_MSK   0x80 /* receive FIFO overflow mask */
 
#define UCTRL_STAT_TXE_STA   0x01 /* transmit FIFO empty status */
 
#define UCTRL_STAT_TXNF_STA   0x02 /* transmit FIFO not full status */
 
#define UCTRL_STAT_RXNE_STA   0x04 /* receive FIFO not empty status */
 
#define UCTRL_STAT_RXO_STA   0x08 /* receive FIFO overflow status */
 
#define WRITEUCTLDATA(value)
 
#define READUCTLDATA(value)
 

Enumerations

enum  uctrl_opcode {
  READ_SERIAL_NUMBER =0x1, READ_ETHERNET_ADDRESS =0x2, READ_HARDWARE_VERSION =0x3, READ_MICROCONTROLLER_VERSION =0x4,
  READ_MAX_TEMPERATURE =0x5, READ_MIN_TEMPERATURE =0x6, READ_CURRENT_TEMPERATURE =0x7, READ_SYSTEM_VARIANT =0x8,
  READ_POWERON_CYCLES =0x9, READ_POWERON_SECONDS =0xA, READ_RESET_STATUS =0xB, READ_EVENT_STATUS =0xC,
  READ_REAL_TIME_CLOCK =0xD, READ_EXTERNAL_VGA_PORT =0xE, READ_MICROCONTROLLER_ROM_CHECKSUM =0xF, READ_ERROR_STATUS =0x10,
  READ_EXTERNAL_STATUS =0x11, READ_USER_CONFIGURATION_AREA =0x12, READ_MICROCONTROLLER_VOLTAGE =0x13, READ_INTERNAL_BATTERY_VOLTAGE =0x14,
  READ_DCIN_VOLTAGE =0x15, READ_HORIZONTAL_POINTER_VOLTAGE =0x16, READ_VERTICAL_POINTER_VOLTAGE =0x17, READ_INTERNAL_BATTERY_CHARGE_LEVEL =0x18,
  READ_EXTERNAL_BATTERY_CHARGE_LEVEL =0x19, READ_REAL_TIME_CLOCK_ALARM =0x1A, READ_EVENT_STATUS_NO_RESET =0x1B, READ_INTERNAL_KEYBOARD_LAYOUT =0x1C,
  READ_EXTERNAL_KEYBOARD_LAYOUT =0x1D, READ_EEPROM_STATUS =0x1E, CONTROL_LCD =0x20, CONTROL_BITPORT =0x21,
  SPEAKER_VOLUME =0x23, CONTROL_TFT_BRIGHTNESS =0x24, CONTROL_WATCHDOG =0x25, CONTROL_FACTORY_EEPROM_AREA =0x26,
  CONTROL_KBD_TIME_UNTIL_REPEAT =0x28, CONTROL_KBD_TIME_BETWEEN_REPEATS =0x29, CONTROL_TIMEZONE =0x2A, CONTROL_MARK_SPACE_RATIO =0x2B,
  CONTROL_DIAGNOSTIC_MODE =0x2E, CONTROL_SCREEN_CONTRAST =0x2F, RING_BELL =0x30, SET_DIAGNOSTIC_STATUS =0x32,
  CLEAR_KEY_COMBINATION_TABLE =0x33, PERFORM_SOFTWARE_RESET =0x34, SET_REAL_TIME_CLOCK =0x35, RECALIBRATE_POINTING_STICK =0x36,
  SET_BELL_FREQUENCY =0x37, SET_INTERNAL_BATTERY_CHARGE_RATE =0x39, SET_EXTERNAL_BATTERY_CHARGE_RATE =0x3A, SET_REAL_TIME_CLOCK_ALARM =0x3B,
  READ_EEPROM =0x40, WRITE_EEPROM =0x41, WRITE_TO_STATUS_DISPLAY =0x42, DEFINE_SPECIAL_CHARACTER =0x43,
  DEFINE_KEY_COMBINATION_ENTRY =0x50, DEFINE_STRING_TABLE_ENTRY =0x51, DEFINE_STATUS_SCREEN_DISPLAY =0x52, PERFORM_EMU_COMMANDS =0x64,
  READ_EMU_REGISTER =0x65, WRITE_EMU_REGISTER =0x66, READ_EMU_RAM =0x67, WRITE_EMU_RAM =0x68,
  READ_BQ_REGISTER =0x69, WRITE_BQ_REGISTER =0x6A, SET_USER_PASSWORD =0x70, VERIFY_USER_PASSWORD =0x71,
  GET_SYSTEM_PASSWORD_KEY =0x72, VERIFY_SYSTEM_PASSWORD =0x73, POWER_OFF =0x82, POWER_RESTART =0x83
}
 

Functions

 MODULE_DEVICE_TABLE (of, uctrl_match)
 
 module_platform_driver (uctrl_driver)
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DEBUG   1

Definition at line 28 of file uctrl.c.

#define dprintk (   x)    printk x

Definition at line 30 of file uctrl.c.

#define READUCTLDATA (   value)
Value:
{ \
unsigned int i; \
value = 0; \
for (i = 0; i < 10000; i++) { \
if ((UCTRL_STAT_RXNE_STA & sbus_readl(&driver->regs->uctrl_stat)) == 0) \
break; \
udelay(1); \
} \
value = sbus_readl(&driver->regs->uctrl_data); \
dprintk(("read data 0x%02x\n", value)); \
sbus_writel(UCTRL_STAT_RXNE_STA, &driver->regs->uctrl_stat); \
}

Definition at line 251 of file uctrl.c.

#define UCTRL_INTR_RXNE_MSK   0x40 /* receive FIFO not empty mask */

Definition at line 65 of file uctrl.c.

#define UCTRL_INTR_RXNE_REQ   0x04 /* receive FIFO not empty int req */

Definition at line 61 of file uctrl.c.

#define UCTRL_INTR_RXO_MSK   0x80 /* receive FIFO overflow mask */

Definition at line 66 of file uctrl.c.

#define UCTRL_INTR_RXO_REQ   0x08 /* receive FIFO overflow int req */

Definition at line 62 of file uctrl.c.

#define UCTRL_INTR_TXE_MSK   0x10 /* transmit FIFO empty mask */

Definition at line 63 of file uctrl.c.

#define UCTRL_INTR_TXE_REQ   0x01 /* transmit FIFO empty int req */

Definition at line 59 of file uctrl.c.

#define UCTRL_INTR_TXNF_MSK   0x20 /* transmit FIFO not full mask */

Definition at line 64 of file uctrl.c.

#define UCTRL_INTR_TXNF_REQ   0x02 /* transmit FIFO not full int req */

Definition at line 60 of file uctrl.c.

#define UCTRL_MINOR   174

Definition at line 26 of file uctrl.c.

#define UCTRL_STAT_RXNE_STA   0x04 /* receive FIFO not empty status */

Definition at line 71 of file uctrl.c.

#define UCTRL_STAT_RXO_STA   0x08 /* receive FIFO overflow status */

Definition at line 72 of file uctrl.c.

#define UCTRL_STAT_TXE_STA   0x01 /* transmit FIFO empty status */

Definition at line 69 of file uctrl.c.

#define UCTRL_STAT_TXNF_STA   0x02 /* transmit FIFO not full status */

Definition at line 70 of file uctrl.c.

#define WRITEUCTLDATA (   value)
Value:
{ \
unsigned int i; \
for (i = 0; i < 10000; i++) { \
if (UCTRL_STAT_TXNF_STA & sbus_readl(&driver->regs->uctrl_stat)) \
break; \
} \
dprintk(("write data 0x%02x\n", value)); \
sbus_writel(value, &driver->regs->uctrl_data); \
}

Definition at line 239 of file uctrl.c.

Enumeration Type Documentation

Enumerator:
READ_SERIAL_NUMBER 
READ_ETHERNET_ADDRESS 
READ_HARDWARE_VERSION 
READ_MICROCONTROLLER_VERSION 
READ_MAX_TEMPERATURE 
READ_MIN_TEMPERATURE 
READ_CURRENT_TEMPERATURE 
READ_SYSTEM_VARIANT 
READ_POWERON_CYCLES 
READ_POWERON_SECONDS 
READ_RESET_STATUS 
READ_EVENT_STATUS 
READ_REAL_TIME_CLOCK 
READ_EXTERNAL_VGA_PORT 
READ_MICROCONTROLLER_ROM_CHECKSUM 
READ_ERROR_STATUS 
READ_EXTERNAL_STATUS 
READ_USER_CONFIGURATION_AREA 
READ_MICROCONTROLLER_VOLTAGE 
READ_INTERNAL_BATTERY_VOLTAGE 
READ_DCIN_VOLTAGE 
READ_HORIZONTAL_POINTER_VOLTAGE 
READ_VERTICAL_POINTER_VOLTAGE 
READ_INTERNAL_BATTERY_CHARGE_LEVEL 
READ_EXTERNAL_BATTERY_CHARGE_LEVEL 
READ_REAL_TIME_CLOCK_ALARM 
READ_EVENT_STATUS_NO_RESET 
READ_INTERNAL_KEYBOARD_LAYOUT 
READ_EXTERNAL_KEYBOARD_LAYOUT 
READ_EEPROM_STATUS 
CONTROL_LCD 
CONTROL_BITPORT 
SPEAKER_VOLUME 
CONTROL_TFT_BRIGHTNESS 
CONTROL_WATCHDOG 
CONTROL_FACTORY_EEPROM_AREA 
CONTROL_KBD_TIME_UNTIL_REPEAT 
CONTROL_KBD_TIME_BETWEEN_REPEATS 
CONTROL_TIMEZONE 
CONTROL_MARK_SPACE_RATIO 
CONTROL_DIAGNOSTIC_MODE 
CONTROL_SCREEN_CONTRAST 
RING_BELL 
SET_DIAGNOSTIC_STATUS 
CLEAR_KEY_COMBINATION_TABLE 
PERFORM_SOFTWARE_RESET 
SET_REAL_TIME_CLOCK 
RECALIBRATE_POINTING_STICK 
SET_BELL_FREQUENCY 
SET_INTERNAL_BATTERY_CHARGE_RATE 
SET_EXTERNAL_BATTERY_CHARGE_RATE 
SET_REAL_TIME_CLOCK_ALARM 
READ_EEPROM 
WRITE_EEPROM 
WRITE_TO_STATUS_DISPLAY 
DEFINE_SPECIAL_CHARACTER 
DEFINE_KEY_COMBINATION_ENTRY 
DEFINE_STRING_TABLE_ENTRY 
DEFINE_STATUS_SCREEN_DISPLAY 
PERFORM_EMU_COMMANDS 
READ_EMU_REGISTER 
WRITE_EMU_REGISTER 
READ_EMU_RAM 
WRITE_EMU_RAM 
READ_BQ_REGISTER 
WRITE_BQ_REGISTER 
SET_USER_PASSWORD 
VERIFY_USER_PASSWORD 
GET_SYSTEM_PASSWORD_KEY 
VERIFY_SYSTEM_PASSWORD 
POWER_OFF 
POWER_RESTART 

Definition at line 115 of file uctrl.c.

Function Documentation

MODULE_DEVICE_TABLE ( of  ,
uctrl_match   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( uctrl_driver  )