/* -*- c-basic-offset: 8 -*-
*
* fw-ohci.c - Driver for OHCI 1394 boards
* Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <linux/dma-mapping.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>
#include "fw-transaction.h"
#include "fw-ohci.h"
#define descriptor_output_more 0
#define descriptor_output_last (1 << 12)
#define descriptor_input_more (2 << 12)
#define descriptor_input_last (3 << 12)
#define descriptor_status (1 << 11)
#define descriptor_key_immediate (2 << 8)
#define descriptor_ping (1 << 7)
#define descriptor_yy (1 << 6)
#define descriptor_no_irq (0 << 4)
#define descriptor_irq_error (1 << 4)
#define descriptor_irq_always (3 << 4)
#define descriptor_branch_always (3 << 2)
struct descriptor {
__le16 req_count;
__le16 control;
__le32 data_address;
__le32 branch_address;
__le16 res_count;
__le16 transfer_status;
} __attribute__((aligned(16)));
struct ar_context {
struct fw_ohci *ohci;
struct descriptor descriptor;
__le32 buffer[512];
dma_addr_t descriptor_bus;
dma_addr_t buffer_bus;
u32 command_ptr;
u32 control_set;
u32 control_clear;
struct tasklet_struct tasklet;
};
struct at_context {
struct fw_ohci *ohci;
dma_addr_t descriptor_bus;
dma_addr_t buffer_bus;
struct list_head list;
struct {
struct descriptor more;
__le32 header[4];
struct descriptor last;
} d;
u32 command_ptr;
u32 control_set;
u32 control_clear;
struct tasklet_struct tasklet;
};
#define it_header_sy(v) ((v) << 0)
#define it_header_tcode(v) ((v) << 4)
#define it