gpio.c 781 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * (C) Copyright 2009
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/cpu.h>
  11. #include <asm/arch/soc.h>
  12. /*
  13. * mvebu_config_gpio - GPIO configuration
  14. */
  15. void mvebu_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val,
  16. u32 gpp0_oe, u32 gpp1_oe)
  17. {
  18. struct kwgpio_registers *gpio0reg =
  19. (struct kwgpio_registers *)MVEBU_GPIO0_BASE;
  20. struct kwgpio_registers *gpio1reg =
  21. (struct kwgpio_registers *)MVEBU_GPIO1_BASE;
  22. /* Init GPIOS to default values as per board requirement */
  23. writel(gpp0_oe_val, &gpio0reg->dout);
  24. writel(gpp1_oe_val, &gpio1reg->dout);
  25. writel(gpp0_oe, &gpio0reg->oe);
  26. writel(gpp1_oe, &gpio1reg->oe);
  27. }