1210284Sjmallett/***********************license start***************
2232812Sjmallett * Copyright (c) 2003-2010  Cavium Inc. (support@cavium.com). All rights
3215990Sjmallett * reserved.
4210284Sjmallett *
5210284Sjmallett *
6215990Sjmallett * Redistribution and use in source and binary forms, with or without
7215990Sjmallett * modification, are permitted provided that the following conditions are
8215990Sjmallett * met:
9210284Sjmallett *
10215990Sjmallett *   * Redistributions of source code must retain the above copyright
11215990Sjmallett *     notice, this list of conditions and the following disclaimer.
12210284Sjmallett *
13215990Sjmallett *   * Redistributions in binary form must reproduce the above
14215990Sjmallett *     copyright notice, this list of conditions and the following
15215990Sjmallett *     disclaimer in the documentation and/or other materials provided
16215990Sjmallett *     with the distribution.
17215990Sjmallett
18232812Sjmallett *   * Neither the name of Cavium Inc. nor the names of
19215990Sjmallett *     its contributors may be used to endorse or promote products
20215990Sjmallett *     derived from this software without specific prior written
21215990Sjmallett *     permission.
22215990Sjmallett
23215990Sjmallett * This Software, including technical data, may be subject to U.S. export  control
24215990Sjmallett * laws, including the U.S. Export Administration Act and its  associated
25215990Sjmallett * regulations, and may be subject to export or import  regulations in other
26215990Sjmallett * countries.
27215990Sjmallett
28215990Sjmallett * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29232812Sjmallett * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30215990Sjmallett * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31215990Sjmallett * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32215990Sjmallett * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33215990Sjmallett * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34215990Sjmallett * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35215990Sjmallett * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36215990Sjmallett * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37215990Sjmallett * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38210284Sjmallett ***********************license end**************************************/
39210284Sjmallett
40210284Sjmallett
41210284Sjmallett
42215990Sjmallett
43210284Sjmallett#ifndef __CVMX_COMPACTFLASH_H__
44210284Sjmallett#define __CVMX_COMPACTFLASH_H__
45210284Sjmallett#ifdef	__cplusplus
46210284Sjmallettextern "C" {
47210284Sjmallett#endif
48210284Sjmallett
49210284Sjmallett
50210284Sjmallett/**
51210284Sjmallett * This function takes values from the compact flash device
52210284Sjmallett * identify response, and returns the appropriate value to write
53210284Sjmallett * into the boot bus DMA timing register.
54210284Sjmallett *
55210284Sjmallett * @param tim_mult   Eclock timing multiple to use
56210284Sjmallett * @param ident_data Data returned by the 'identify' command.  This is used to
57210284Sjmallett *                   determine the DMA modes supported by the card, if any.
58210284Sjmallett * @param mwdma_mode_ptr
59210284Sjmallett *                   Optional pointer to return MWDMA mode in
60210284Sjmallett *
61210284Sjmallett * @return 64 bit value to write to DMA timing register
62210284Sjmallett */
63210284Sjmallettextern uint64_t cvmx_compactflash_generate_dma_tim(int tim_mult, uint16_t *ident_data, int *mwdma_mode_ptr);
64210284Sjmallett
65210284Sjmallett/**
66210284Sjmallett * Setup timing and region config to support a specific IDE PIO
67210284Sjmallett * mode over the bootbus.
68210284Sjmallett *
69210284Sjmallett * @param cs0      Bootbus region number connected to CS0 on the IDE device
70210284Sjmallett * @param cs1      Bootbus region number connected to CS1 on the IDE device
71210284Sjmallett * @param pio_mode PIO mode to set (0-6)
72210284Sjmallett */
73210284Sjmallettextern void cvmx_compactflash_set_piomode(int cs0, int cs1, int pio_mode);
74210284Sjmallett
75210284Sjmallett#ifdef	__cplusplus
76210284Sjmallett}
77210284Sjmallett#endif
78210284Sjmallett#endif   /* __CVMX_COMPACTFLASH_H__ */
79