led.c 720 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * (C) Copyright 2007-2008
  3. * Stelian Pop <stelian@popies.net>
  4. * Lead Tech Design <www.leadtechdesign.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/gpio.h>
  11. #include <asm/arch/at91_pmc.h>
  12. #include <asm/arch/at91sam9263.h>
  13. void coloured_LED_init(void)
  14. {
  15. /* Enable clock */
  16. at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
  17. writel(1 << ATMEL_ID_PIOB | 1 << ATMEL_ID_PIOCDE,
  18. &pmc->pcer);
  19. at91_set_gpio_output(CONFIG_RED_LED, 1);
  20. at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  21. at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
  22. at91_set_gpio_value(CONFIG_RED_LED, 0);
  23. at91_set_gpio_value(CONFIG_GREEN_LED, 1);
  24. at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
  25. }