linux/drivers/staging/gs_fpgaboot/io.h
<<
>>
Prefs
   1/*
   2 * This program is free software; you can redistribute it and/or modify
   3 * it under the terms of the GNU General Public License as published by
   4 * the Free Software Foundation; either version 2 of the License, or
   5 * (at your option) any later version.
   6 *
   7 * This program is distributed in the hope that it will be useful,
   8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
   9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10 * GNU General Public License for more details.
  11 */
  12
  13#define GPDIR   0
  14#define GPCFG   4       /* open drain or not */
  15#define GPDAT   8
  16
  17/*
  18 * gpio port and pin definitions
  19 * NOTE: port number starts from 0
  20 */
  21#define XL_INITN_PORT   1
  22#define XL_INITN_PIN    14
  23#define XL_RDWRN_PORT   1
  24#define XL_RDWRN_PIN    13
  25#define XL_CCLK_PORT    1
  26#define XL_CCLK_PIN     10
  27#define XL_PROGN_PORT   1
  28#define XL_PROGN_PIN    25
  29#define XL_CSIN_PORT    1
  30#define XL_CSIN_PIN     26
  31#define XL_DONE_PORT    1
  32#define XL_DONE_PIN     27
  33
  34/*
  35 * gpio mapping
  36 *
  37        XL_config_D0 – gpio1_31
  38        Xl_config_d1 – gpio1_30
  39        Xl_config_d2 – gpio1_29
  40        Xl_config_d3 – gpio1_28
  41        Xl_config_d4 – gpio1_27
  42        Xl_config_d5 – gpio1_26
  43        Xl_config_d6 – gpio1_25
  44        Xl_config_d7 – gpio1_24
  45        Xl_config_d8 – gpio1_23
  46        Xl_config_d9 – gpio1_22
  47        Xl_config_d10 – gpio1_21
  48        Xl_config_d11 – gpio1_20
  49        Xl_config_d12 – gpio1_19
  50        Xl_config_d13 – gpio1_18
  51        Xl_config_d14 – gpio1_16
  52        Xl_config_d15 – gpio1_14
  53*
  54*/
  55
  56/*
  57 * program bus width in bytes
  58 */
  59enum wbus {
  60        bus_1byte       = 1,
  61        bus_2byte       = 2,
  62};
  63
  64#define MAX_WAIT_DONE   10000
  65
  66struct gpiobus {
  67        int     ngpio;
  68        void __iomem *r[4];
  69};
  70
  71int xl_supported_prog_bus_width(enum wbus bus_bytes);
  72
  73void xl_program_b(int32_t i);
  74void xl_rdwr_b(int32_t i);
  75void xl_csi_b(int32_t i);
  76
  77int xl_get_init_b(void);
  78int xl_get_done_b(void);
  79
  80void xl_shift_cclk(int count);
  81void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata);
  82
  83int xl_init_io(void);
  84