gpio.c 778 B

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