uboot/arch/arm/include/asm/arch-bcm2835/gpio.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2012 Vikram Narayananan
   3 * <vikram186@gmail.com>
   4 *
   5 * See file CREDITS for list of people who contributed to this
   6 * project.
   7 *
   8 * This program is free software; you can redistribute it and/or
   9 * modify it under the terms of the GNU General Public License as
  10 * published by the Free Software Foundation; either version 2 of
  11 * the License, or (at your option) any later version.
  12 *
  13 * This program is distributed in the hope that it will be useful,
  14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16 * GNU General Public License for more details.
  17 */
  18
  19#ifndef _BCM2835_GPIO_H_
  20#define _BCM2835_GPIO_H_
  21
  22#define BCM2835_GPIO_BASE               0x20200000
  23#define BCM2835_GPIO_COUNT              54
  24
  25#define BCM2835_GPIO_FSEL_MASK          0x7
  26#define BCM2835_GPIO_INPUT              0x0
  27#define BCM2835_GPIO_OUTPUT             0x1
  28#define BCM2835_GPIO_ALT0               0x4
  29#define BCM2835_GPIO_ALT1               0x5
  30#define BCM2835_GPIO_ALT2               0x6
  31#define BCM2835_GPIO_ALT3               0x7
  32#define BCM2835_GPIO_ALT4               0x3
  33#define BCM2835_GPIO_ALT5               0x2
  34
  35#define BCM2835_GPIO_COMMON_BANK(gpio)  ((gpio < 32) ? 0 : 1)
  36#define BCM2835_GPIO_COMMON_SHIFT(gpio) (gpio & 0x1f)
  37
  38#define BCM2835_GPIO_FSEL_BANK(gpio)    (gpio / 10)
  39#define BCM2835_GPIO_FSEL_SHIFT(gpio)   ((gpio % 10) * 3)
  40
  41struct bcm2835_gpio_regs {
  42        u32 gpfsel[6];
  43        u32 reserved1;
  44        u32 gpset[2];
  45        u32 reserved2;
  46        u32 gpclr[2];
  47        u32 reserved3;
  48        u32 gplev[2];
  49        u32 reserved4;
  50        u32 gpeds[2];
  51        u32 reserved5;
  52        u32 gpren[2];
  53        u32 reserved6;
  54        u32 gpfen[2];
  55        u32 reserved7;
  56        u32 gphen[2];
  57        u32 reserved8;
  58        u32 gplen[2];
  59        u32 reserved9;
  60        u32 gparen[2];
  61        u32 reserved10;
  62        u32 gppud;
  63        u32 gppudclk[2];
  64};
  65
  66#endif /* _BCM2835_GPIO_H_ */
  67