simtec-nor.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* linux/arch/arm/mach-s3c2410/nor-simtec.c
  2. *
  3. * Copyright (c) 2008 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * Simtec NOR mapping
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/module.h>
  14. #include <linux/types.h>
  15. #include <linux/init.h>
  16. #include <linux/kernel.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/mtd/mtd.h>
  19. #include <linux/mtd/map.h>
  20. #include <linux/mtd/physmap.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/irq.h>
  25. #include <mach/map.h>
  26. #include "bast.h"
  27. #include "simtec.h"
  28. static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
  29. {
  30. unsigned int val;
  31. val = __raw_readb(BAST_VA_CTRL3);
  32. printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
  33. if (vpp)
  34. val |= BAST_CPLD_CTRL3_ROMWEN;
  35. else
  36. val &= ~BAST_CPLD_CTRL3_ROMWEN;
  37. __raw_writeb(val, BAST_VA_CTRL3);
  38. }
  39. static struct physmap_flash_data simtec_nor_pdata = {
  40. .width = 2,
  41. .set_vpp = simtec_nor_vpp,
  42. .nr_parts = 0,
  43. };
  44. static struct resource simtec_nor_resource[] = {
  45. [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
  46. };
  47. static struct platform_device simtec_device_nor = {
  48. .name = "physmap-flash",
  49. .id = -1,
  50. .num_resources = ARRAY_SIZE(simtec_nor_resource),
  51. .resource = simtec_nor_resource,
  52. .dev = {
  53. .platform_data = &simtec_nor_pdata,
  54. },
  55. };
  56. void __init nor_simtec_init(void)
  57. {
  58. int ret;
  59. ret = platform_device_register(&simtec_device_nor);
  60. if (ret < 0)
  61. printk(KERN_ERR "failed to register physmap-flash device\n");
  62. else
  63. simtec_nor_vpp(NULL, 1);
  64. }