/*
- Copyright © 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation.
*/
#include <linux/err.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#define ARC_PS2_PORTS 2
#define ARC_ARC_PS2_ID 0x0001f609
#define STAT_TIMEOUT 128
#define PS2_STAT_RX_FRM_ERR (1)
#define PS2_STAT_RX_BUF_OVER (1 << 1)
#define PS2_STAT_RX_INT_EN (1 << 2)
#define PS2_STAT_RX_VAL (1 << 3)
#define PS2_STAT_TX_ISNOT_FUL (1 << 4)
#define PS2_STAT_TX_INT_EN (1 << 5)
struct arc_ps2_port {
void __iomem *data_addr;
void __iomem *status_addr;
struct serio *io;
};
struct arc_ps2_data {
struct arc_ps2_port port[ARC_PS2_PORTS];
void __iomem *addr;
unsigned int frame_error;
unsigned int buf_overflow;
unsigned int total_int;
};
static void arc_ps2_check_rx(struct arc_ps2_data *arc_ps2,
struct arc_ps2_port *port)
{
unsigned int timeout = 10