setup.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * s6105 control routines
  3. *
  4. * Copyright (c) 2009 emlix GmbH
  5. */
  6. #include <linux/irq.h>
  7. #include <linux/io.h>
  8. #include <linux/gpio.h>
  9. #include <asm/bootparam.h>
  10. #include <variant/hardware.h>
  11. #include <variant/gpio.h>
  12. #include <platform/gpio.h>
  13. void platform_halt(void)
  14. {
  15. local_irq_disable();
  16. while (1)
  17. ;
  18. }
  19. void platform_power_off(void)
  20. {
  21. platform_halt();
  22. }
  23. void platform_restart(void)
  24. {
  25. platform_halt();
  26. }
  27. void __init platform_setup(char **cmdline)
  28. {
  29. unsigned long reg;
  30. reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
  31. reg &= ~(1 << S6_GREG1_BLOCK_SB);
  32. writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
  33. reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
  34. reg |= 1 << S6_GREG1_BLOCK_SB;
  35. writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
  36. printk(KERN_NOTICE "S6105 on Stretch S6000 - "
  37. "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
  38. }
  39. void __init platform_init(bp_tag_t *first)
  40. {
  41. s6_gpio_init();
  42. gpio_request(GPIO_LED1_NGREEN, "led1_green");
  43. gpio_request(GPIO_LED1_RED, "led1_red");
  44. gpio_direction_output(GPIO_LED1_NGREEN, 1);
  45. }
  46. void platform_heartbeat(void)
  47. {
  48. static unsigned int c;
  49. if (!(++c & 0x4F))
  50. gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
  51. }