board-nhk8815.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * linux/arch/arm/mach-nomadik/board-8815nhk.c
  3. *
  4. * Copyright (C) STMicroelectronics
  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 version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. * NHK15 board specifc driver definition
  11. */
  12. #include <linux/types.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/amba/bus.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/gpio.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/irq.h>
  22. #include <mach/setup.h>
  23. #include "clock.h"
  24. #define __MEM_4K_RESOURCE(x) \
  25. .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
  26. static struct amba_device uart0_device = {
  27. .dev = { .init_name = "uart0" },
  28. __MEM_4K_RESOURCE(NOMADIK_UART0_BASE),
  29. .irq = {IRQ_UART0, NO_IRQ},
  30. };
  31. static struct amba_device uart1_device = {
  32. .dev = { .init_name = "uart1" },
  33. __MEM_4K_RESOURCE(NOMADIK_UART1_BASE),
  34. .irq = {IRQ_UART1, NO_IRQ},
  35. };
  36. static struct amba_device *amba_devs[] __initdata = {
  37. &uart0_device,
  38. &uart1_device,
  39. };
  40. /* We have a fixed clock alone, by now */
  41. static struct clk nhk8815_clk_48 = {
  42. .rate = 48*1000*1000,
  43. };
  44. static struct resource nhk8815_eth_resources[] = {
  45. {
  46. .name = "smc91x-regs",
  47. .start = 0x34000000 + 0x300,
  48. .end = 0x34000000 + SZ_64K - 1,
  49. .flags = IORESOURCE_MEM,
  50. }, {
  51. .start = NOMADIK_GPIO_TO_IRQ(115),
  52. .end = NOMADIK_GPIO_TO_IRQ(115),
  53. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  54. }
  55. };
  56. static struct platform_device nhk8815_eth_device = {
  57. .name = "smc91x",
  58. .resource = nhk8815_eth_resources,
  59. .num_resources = ARRAY_SIZE(nhk8815_eth_resources),
  60. };
  61. static int __init nhk8815_eth_init(void)
  62. {
  63. int gpio_nr = 115; /* hardwired in the board */
  64. int err;
  65. err = gpio_request(gpio_nr, "eth_irq");
  66. if (!err) err = nmk_gpio_set_mode(gpio_nr, NMK_GPIO_ALT_GPIO);
  67. if (!err) err = gpio_direction_input(gpio_nr);
  68. if (err)
  69. pr_err("Error %i in %s\n", err, __func__);
  70. return err;
  71. }
  72. device_initcall(nhk8815_eth_init);
  73. static struct platform_device *nhk8815_platform_devices[] __initdata = {
  74. &nhk8815_eth_device,
  75. /* will add more devices */
  76. };
  77. static void __init nhk8815_platform_init(void)
  78. {
  79. int i;
  80. cpu8815_platform_init();
  81. platform_add_devices(nhk8815_platform_devices,
  82. ARRAY_SIZE(nhk8815_platform_devices));
  83. for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  84. nmdk_clk_create(&nhk8815_clk_48, amba_devs[i]->dev.init_name);
  85. amba_device_register(amba_devs[i], &iomem_resource);
  86. }
  87. }
  88. MACHINE_START(NOMADIK, "NHK8815")
  89. /* Maintainer: ST MicroElectronics */
  90. .phys_io = NOMADIK_UART0_BASE,
  91. .io_pg_offst = (IO_ADDRESS(NOMADIK_UART0_BASE) >> 18) & 0xfffc,
  92. .boot_params = 0x100,
  93. .map_io = cpu8815_map_io,
  94. .init_irq = cpu8815_init_irq,
  95. .timer = &nomadik_timer,
  96. .init_machine = nhk8815_platform_init,
  97. MACHINE_END