os/linux-2.6-tag--devboard-R2_10-4/drivers/ide/cris/ide-cris.c File Reference

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/arch/svinto.h>
#include <asm/arch/io_interface_mux.h>

Include dependency graph for ide-cris.c:

Go to the source code of this file.

Defines

#define MAX_DMA_DESCRS   64
#define IDE_REGISTER_TIMEOUT   300
#define LOWDB(x)
 here is a place to enable hardware debugging
#define D(x)
#define ATA_UDMA2_CYC   0
#define ATA_UDMA2_DVS   0
#define ATA_UDMA1_CYC   0
#define ATA_UDMA1_DVS   0
#define ATA_UDMA0_CYC   0
#define ATA_UDMA0_DVS   0
#define ATA_DMA2_STROBE   4
#define ATA_DMA2_HOLD   0
#define ATA_DMA1_STROBE   4
#define ATA_DMA1_HOLD   1
#define ATA_DMA0_STROBE   12
#define ATA_DMA0_HOLD   9
#define ATA_PIO4_SETUP   1
#define ATA_PIO4_STROBE   5
#define ATA_PIO4_HOLD   0
#define ATA_PIO3_SETUP   1
#define ATA_PIO3_STROBE   5
#define ATA_PIO3_HOLD   1
#define ATA_PIO2_SETUP   1
#define ATA_PIO2_STROBE   6
#define ATA_PIO2_HOLD   2
#define ATA_PIO1_SETUP   2
#define ATA_PIO1_STROBE   11
#define ATA_PIO1_HOLD   4
#define ATA_PIO0_SETUP   4
#define ATA_PIO0_STROBE   19
#define ATA_PIO0_HOLD   4
#define cris_dma_descr_type   etrax_dma_descr
#define cris_pio_read   IO_STATE(R_ATA_CTRL_DATA, rw, read)
#define cris_ultra_mask   0x0
#define IRQ   4
#define MAX_DESCR_SIZE   0x10000UL

Enumerations

enum  { TYPE_PIO, TYPE_DMA, TYPE_UDMA }

Functions

int cris_ide_ack_intr (ide_hwif_t *hwif)
static int cris_ide_busy (void)
static int cris_ide_ready (void)
static int cris_ide_data_available (unsigned short *data)
static void cris_ide_write_command (unsigned long command)
static void cris_ide_set_speed (int type, int setup, int strobe, int hold)
static unsigned long cris_ide_base_address (int bus)
static unsigned long cris_ide_reg_addr (unsigned long addr, int cs0, int cs1)
static __init void cris_ide_reset (unsigned val)
static __init void cris_ide_init (void)
static unsigned long cris_ide_get_reg (unsigned long reg)
static void cris_ide_fill_descriptor (cris_dma_descr_type *d, void *buf, unsigned int len, int last)
static void cris_ide_start_dma (ide_drive_t *drive, cris_dma_descr_type *d, int dir, int type, int len)
static void cris_ide_wait_dma (int dir)
static int cris_dma_test_irq (ide_drive_t *drive)
static void cris_ide_initialize_dma (int dir)
void cris_ide_outw (unsigned short data, unsigned long reg)
void cris_ide_outb (unsigned char data, unsigned long reg)
void cris_ide_outbsync (ide_drive_t *drive, u8 addr, unsigned long port)
unsigned short cris_ide_inw (unsigned long reg)
unsigned char cris_ide_inb (unsigned long reg)
static int cris_dma_check (ide_drive_t *drive)
static int cris_dma_end (ide_drive_t *drive)
static int cris_dma_setup (ide_drive_t *drive)
static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command)
static void cris_dma_start (ide_drive_t *drive)
static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int)
static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int)
static void cris_atapi_input_bytes (ide_drive_t *drive, void *, unsigned int)
static void cris_atapi_output_bytes (ide_drive_t *drive, void *, unsigned int)
static int cris_dma_off (ide_drive_t *drive)
static int cris_dma_on (ide_drive_t *drive)
static int cris_dma_host_off (ide_drive_t *drive)
static int cris_dma_host_on (ide_drive_t *drive)
static void tune_cris_ide (ide_drive_t *drive, u8 pio)
static int speed_cris_ide (ide_drive_t *drive, u8 speed)
void __init init_e100_ide (void)
static cris_dma_descr_type
mydescr 
__attribute__ ((__aligned__(16)))
static int cris_ide_build_dmatable (ide_drive_t *drive)
static int cris_config_drive_for_dma (ide_drive_t *drive)
static ide_startstop_t cris_dma_intr (ide_drive_t *drive)

Variables

int _353_io_board_present
static unsigned int ata_tot_size


Define Documentation

#define ATA_DMA0_HOLD   9

Definition at line 403 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_DMA0_STROBE   12

Definition at line 402 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_DMA1_HOLD   1

Definition at line 401 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_DMA1_STROBE   4

Definition at line 400 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_DMA2_HOLD   0

Definition at line 399 of file ide-cris.c.

Referenced by cris_ide_set_speed(), init_e100_ide(), and speed_cris_ide().

#define ATA_DMA2_STROBE   4

Definition at line 398 of file ide-cris.c.

Referenced by cris_ide_set_speed(), init_e100_ide(), and speed_cris_ide().

#define ATA_PIO0_HOLD   4

Definition at line 418 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO0_SETUP   4

Definition at line 416 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO0_STROBE   19

Definition at line 417 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO1_HOLD   4

Definition at line 415 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO1_SETUP   2

Definition at line 413 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO1_STROBE   11

Definition at line 414 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO2_HOLD   2

Definition at line 412 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO2_SETUP   1

Definition at line 410 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO2_STROBE   6

Definition at line 411 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO3_HOLD   1

Definition at line 409 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO3_SETUP   1

Definition at line 407 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO3_STROBE   5

Definition at line 408 of file ide-cris.c.

Referenced by tune_cris_ide().

#define ATA_PIO4_HOLD   0

Definition at line 406 of file ide-cris.c.

Referenced by cris_ide_set_speed(), init_e100_ide(), and tune_cris_ide().

#define ATA_PIO4_SETUP   1

Definition at line 404 of file ide-cris.c.

Referenced by cris_ide_set_speed(), init_e100_ide(), and tune_cris_ide().

#define ATA_PIO4_STROBE   5

Definition at line 405 of file ide-cris.c.

Referenced by cris_ide_set_speed(), init_e100_ide(), and tune_cris_ide().

#define ATA_UDMA0_CYC   0

Definition at line 396 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_UDMA0_DVS   0

Definition at line 397 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_UDMA1_CYC   0

Definition at line 394 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_UDMA1_DVS   0

Definition at line 395 of file ide-cris.c.

Referenced by speed_cris_ide().

#define ATA_UDMA2_CYC   0

Definition at line 392 of file ide-cris.c.

Referenced by init_e100_ide(), and speed_cris_ide().

#define ATA_UDMA2_DVS   0

Definition at line 393 of file ide-cris.c.

Referenced by init_e100_ide(), and speed_cris_ide().

#define cris_dma_descr_type   etrax_dma_descr

Definition at line 562 of file ide-cris.c.

#define cris_pio_read   IO_STATE(R_ATA_CTRL_DATA, rw, read)

Definition at line 563 of file ide-cris.c.

Referenced by cris_ide_inw().

#define cris_ultra_mask   0x0

Definition at line 564 of file ide-cris.c.

Referenced by init_e100_ide().

#define D ( x   ) 

Definition at line 49 of file ide-cris.c.

#define IDE_REGISTER_TIMEOUT   300

Definition at line 44 of file ide-cris.c.

Referenced by cris_ide_inw(), and cris_ide_outw().

#define IRQ   4

Definition at line 565 of file ide-cris.c.

Referenced by createDefaultConfig(), init_e100_ide(), and profileShow().

#define LOWDB ( x   ) 

here is a place to enable hardware debugging

Definition at line 48 of file ide-cris.c.

Referenced by cris_ide_inw(), and cris_ide_outw().

#define MAX_DESCR_SIZE   0x10000UL

Definition at line 566 of file ide-cris.c.

Referenced by cris_ide_build_dmatable(), and cris_ide_fill_descriptor().

#define MAX_DMA_DESCRS   64

Definition at line 37 of file ide-cris.c.

Referenced by cris_ide_build_dmatable().


Enumeration Type Documentation

anonymous enum

Enumerator:
TYPE_PIO 
TYPE_DMA 
TYPE_UDMA 

Definition at line 56 of file ide-cris.c.


Function Documentation

static cris_dma_descr_type mydescr __attribute__ ( (__aligned__(16))   )  [static]

static void cris_atapi_input_bytes ( ide_drive_t *  drive,
void *  ,
unsigned  int 
) [static]

Definition at line 964 of file ide-cris.c.

References cris_ide_fill_descriptor(), cris_ide_start_dma(), cris_ide_wait_dma(), D, LED_DISK_READ, printk, and TYPE_PIO.

Referenced by cris_ide_input_data(), and init_e100_ide().

static void cris_atapi_output_bytes ( ide_drive_t *  drive,
void *  ,
unsigned  int 
) [static]

Definition at line 986 of file ide-cris.c.

References cris_ide_fill_descriptor(), cris_ide_start_dma(), cris_ide_wait_dma(), D, LED_DISK_READ, LED_DISK_WRITE, printk, and TYPE_PIO.

Referenced by cris_ide_output_data(), and init_e100_ide().

static int cris_config_drive_for_dma ( ide_drive_t *  drive  )  [static]

Definition at line 1114 of file ide-cris.c.

References speed_cris_ide().

Referenced by cris_dma_check().

static int cris_dma_check ( ide_drive_t *  drive  )  [static]

Definition at line 1154 of file ide-cris.c.

References cris_config_drive_for_dma(), and ide_use_dma().

Referenced by init_e100_ide().

static int cris_dma_end ( ide_drive_t *  drive  )  [static]

Definition at line 1173 of file ide-cris.c.

Referenced by init_e100_ide().

static void cris_dma_exec_cmd ( ide_drive_t *  drive,
u8  command 
) [static]

Definition at line 1193 of file ide-cris.c.

References cris_dma_intr(), and cris_ide_outb().

Referenced by init_e100_ide().

static int cris_dma_host_off ( ide_drive_t *  drive  )  [static]

Definition at line 931 of file ide-cris.c.

Referenced by init_e100_ide().

static int cris_dma_host_on ( ide_drive_t *  drive  )  [static]

Definition at line 936 of file ide-cris.c.

Referenced by init_e100_ide().

static ide_startstop_t cris_dma_intr ( ide_drive_t *  drive  )  [static]

Definition at line 1130 of file ide-cris.c.

References ide_dma_intr(), LED_DISK_READ, and LED_DISK_WRITE.

Referenced by cris_dma_exec_cmd().

static int cris_dma_off ( ide_drive_t *  drive  )  [static]

Definition at line 941 of file ide-cris.c.

Referenced by init_e100_ide().

static int cris_dma_on ( ide_drive_t *  drive  )  [static]

Definition at line 947 of file ide-cris.c.

Referenced by init_e100_ide().

static int cris_dma_setup ( ide_drive_t *  drive  )  [static]

Definition at line 1179 of file ide-cris.c.

References cris_ide_build_dmatable(), and cris_ide_initialize_dma().

Referenced by init_e100_ide().

static void cris_dma_start ( ide_drive_t *  drive  )  [static]

Definition at line 1202 of file ide-cris.c.

References cris_ide_start_dma(), LED_DISK_READ, LED_DISK_WRITE, TYPE_DMA, and TYPE_UDMA.

Referenced by init_e100_ide().

static int cris_dma_test_irq ( ide_drive_t *  drive  )  [static]

Definition at line 629 of file ide-cris.c.

References bus.

Referenced by init_e100_ide().

int cris_ide_ack_intr ( ide_hwif_t *  hwif  ) 

Definition at line 421 of file ide-cris.c.

Referenced by init_e100_ide().

static unsigned long cris_ide_base_address ( int  bus  )  [static]

Definition at line 478 of file ide-cris.c.

Referenced by init_e100_ide().

static int cris_ide_build_dmatable ( ide_drive_t *  drive  )  [static]

Definition at line 1033 of file ide-cris.c.

References cris_ide_fill_descriptor(), MAX_DESCR_SIZE, MAX_DMA_DESCRS, printk, and size.

Referenced by cris_dma_setup().

static int cris_ide_busy ( void   )  [inline, static]

Definition at line 427 of file ide-cris.c.

Referenced by cris_ide_inw(), and cris_ide_outw().

static int cris_ide_data_available ( unsigned short *  data  )  [inline, static]

Definition at line 439 of file ide-cris.c.

Referenced by cris_ide_inw().

static void cris_ide_fill_descriptor ( cris_dma_descr_type *  d,
void *  buf,
unsigned int  len,
int  last 
) [static]

Definition at line 575 of file ide-cris.c.

References MAX_DESCR_SIZE.

Referenced by cris_atapi_input_bytes(), cris_atapi_output_bytes(), and cris_ide_build_dmatable().

static unsigned long cris_ide_get_reg ( unsigned long  reg  )  [static]

Definition at line 569 of file ide-cris.c.

Referenced by cris_ide_inw().

unsigned char cris_ide_inb ( unsigned long  reg  ) 

Definition at line 749 of file ide-cris.c.

References cris_ide_inw().

Referenced by init_e100_ide().

static __init void cris_ide_init ( void   )  [static]

Definition at line 512 of file ide-cris.c.

References printk, read, and set.

Referenced by init_e100_ide().

static void cris_ide_initialize_dma ( int  dir  )  [static]

Definition at line 637 of file ide-cris.c.

Referenced by cris_dma_setup().

static void cris_ide_input_data ( ide_drive_t *  drive,
void *  ,
unsigned  int 
) [static]

Definition at line 1011 of file ide-cris.c.

References cris_atapi_input_bytes().

Referenced by init_e100_ide().

unsigned short cris_ide_inw ( unsigned long  reg  ) 

Definition at line 701 of file ide-cris.c.

References cris_ide_busy(), cris_ide_data_available(), cris_ide_get_reg(), cris_ide_write_command(), cris_pio_read, IDE_REGISTER_TIMEOUT, LOWDB, and printk.

Referenced by cris_ide_inb(), and init_e100_ide().

void cris_ide_outb ( unsigned char  data,
unsigned long  reg 
)

Definition at line 689 of file ide-cris.c.

References cris_ide_outw().

Referenced by cris_dma_exec_cmd(), and init_e100_ide().

void cris_ide_outbsync ( ide_drive_t *  drive,
u8  addr,
unsigned long  port 
)

Definition at line 695 of file ide-cris.c.

References cris_ide_outw().

Referenced by init_e100_ide().

static void cris_ide_output_data ( ide_drive_t *  drive,
void *  ,
unsigned  int 
) [static]

Definition at line 1020 of file ide-cris.c.

References cris_atapi_output_bytes().

Referenced by init_e100_ide().

void cris_ide_outw ( unsigned short  data,
unsigned long  reg 
)

Definition at line 654 of file ide-cris.c.

References cris_ide_busy(), cris_ide_ready(), cris_ide_write_command(), IDE_REGISTER_TIMEOUT, LOWDB, and printk.

Referenced by cris_ide_outb(), cris_ide_outbsync(), and init_e100_ide().

static int cris_ide_ready ( void   )  [inline, static]

Definition at line 433 of file ide-cris.c.

Referenced by cris_ide_outw().

static unsigned long cris_ide_reg_addr ( unsigned long  addr,
int  cs0,
int  cs1 
) [static]

Definition at line 484 of file ide-cris.c.

Referenced by init_e100_ide().

static __init void cris_ide_reset ( unsigned  val  )  [static]

Definition at line 492 of file ide-cris.c.

References port_csp0_addr.

Referenced by init_e100_ide().

static void cris_ide_set_speed ( int  type,
int  setup,
int  strobe,
int  hold 
) [static]

Definition at line 453 of file ide-cris.c.

References ATA_DMA2_HOLD, ATA_DMA2_STROBE, ATA_PIO4_HOLD, ATA_PIO4_SETUP, ATA_PIO4_STROBE, TYPE_DMA, and TYPE_PIO.

Referenced by init_e100_ide(), speed_cris_ide(), and tune_cris_ide().

static void cris_ide_start_dma ( ide_drive_t *  drive,
cris_dma_descr_type *  d,
int  dir,
int  type,
int  len 
) [static]

Definition at line 583 of file ide-cris.c.

References cmd, data, read, start, TYPE_PIO, and write.

Referenced by cris_atapi_input_bytes(), cris_atapi_output_bytes(), and cris_dma_start().

static void cris_ide_wait_dma ( int  dir  )  [static]

Definition at line 621 of file ide-cris.c.

Referenced by cris_atapi_input_bytes(), and cris_atapi_output_bytes().

static void cris_ide_write_command ( unsigned long  command  )  [static]

Definition at line 447 of file ide-cris.c.

Referenced by cris_ide_inw(), and cris_ide_outw().

void __init init_e100_ide ( void   ) 

Definition at line 857 of file ide-cris.c.

References ATA_DMA2_HOLD, ATA_DMA2_STROBE, ATA_PIO4_HOLD, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_UDMA2_CYC, ATA_UDMA2_DVS, cris_atapi_input_bytes(), cris_atapi_output_bytes(), cris_dma_check(), cris_dma_end(), cris_dma_exec_cmd(), cris_dma_host_off(), cris_dma_host_on(), cris_dma_off(), cris_dma_on(), cris_dma_setup(), cris_dma_start(), cris_dma_test_irq(), cris_ide_ack_intr(), cris_ide_base_address(), cris_ide_inb(), cris_ide_init(), cris_ide_input_data(), cris_ide_inw(), cris_ide_outb(), cris_ide_outbsync(), cris_ide_output_data(), cris_ide_outw(), cris_ide_reg_addr(), cris_ide_reset(), cris_ide_set_speed(), cris_ultra_mask, IRQ, memset(), printk, speed_cris_ide(), tune_cris_ide(), TYPE_DMA, TYPE_PIO, TYPE_UDMA, and udelay.

static int speed_cris_ide ( ide_drive_t *  drive,
u8  speed 
) [static]

Definition at line 807 of file ide-cris.c.

References ATA_DMA0_HOLD, ATA_DMA0_STROBE, ATA_DMA1_HOLD, ATA_DMA1_STROBE, ATA_DMA2_HOLD, ATA_DMA2_STROBE, ATA_UDMA0_CYC, ATA_UDMA0_DVS, ATA_UDMA1_CYC, ATA_UDMA1_DVS, ATA_UDMA2_CYC, ATA_UDMA2_DVS, cris_ide_set_speed(), tune_cris_ide(), TYPE_DMA, and TYPE_UDMA.

Referenced by cris_config_drive_for_dma(), and init_e100_ide().

static void tune_cris_ide ( ide_drive_t *  drive,
u8  pio 
) [static]

Definition at line 769 of file ide-cris.c.

References ATA_PIO0_HOLD, ATA_PIO0_SETUP, ATA_PIO0_STROBE, ATA_PIO1_HOLD, ATA_PIO1_SETUP, ATA_PIO1_STROBE, ATA_PIO2_HOLD, ATA_PIO2_SETUP, ATA_PIO2_STROBE, ATA_PIO3_HOLD, ATA_PIO3_SETUP, ATA_PIO3_STROBE, ATA_PIO4_HOLD, ATA_PIO4_SETUP, ATA_PIO4_STROBE, cris_ide_set_speed(), and TYPE_PIO.

Referenced by init_e100_ide(), and speed_cris_ide().


Variable Documentation

int _353_io_board_present

Definition at line 85 of file io.c.

unsigned int ata_tot_size [static]

Definition at line 1027 of file ide-cris.c.


Generated on Fri Nov 28 00:08:20 2008 for elphel by  doxygen 1.5.1