devices.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * CLPS711X common devices definitions
  3. *
  4. * Author: Alexander Shiyan <shc_work@mail.ru>, 2013
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <mach/hardware.h>
  13. static const phys_addr_t clps711x_gpios[][2] __initconst = {
  14. { PADR, PADDR },
  15. { PBDR, PBDDR },
  16. { PCDR, PCDDR },
  17. { PDDR, PDDDR },
  18. { PEDR, PEDDR },
  19. };
  20. static void __init clps711x_add_gpio(void)
  21. {
  22. unsigned i;
  23. struct resource gpio_res[2];
  24. memset(gpio_res, 0, sizeof(gpio_res));
  25. gpio_res[0].flags = IORESOURCE_MEM;
  26. gpio_res[1].flags = IORESOURCE_MEM;
  27. for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
  28. gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
  29. gpio_res[0].end = gpio_res[0].start;
  30. gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
  31. gpio_res[1].end = gpio_res[1].start;
  32. platform_device_register_simple("clps711x-gpio", i,
  33. gpio_res, ARRAY_SIZE(gpio_res));
  34. }
  35. }
  36. void __init clps711x_devices_init(void)
  37. {
  38. clps711x_add_gpio();
  39. }