root/arch/arm/mach-s3c24xx/simtec-nor.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. simtec_nor_vpp
  2. nor_simtec_init

   1 // SPDX-License-Identifier: GPL-2.0
   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 #include <linux/module.h>
  10 #include <linux/types.h>
  11 #include <linux/init.h>
  12 #include <linux/kernel.h>
  13 #include <linux/platform_device.h>
  14 
  15 #include <linux/mtd/mtd.h>
  16 #include <linux/mtd/map.h>
  17 #include <linux/mtd/physmap.h>
  18 #include <linux/mtd/partitions.h>
  19 
  20 #include <asm/mach/arch.h>
  21 #include <asm/mach/map.h>
  22 #include <asm/mach/irq.h>
  23 
  24 #include <mach/map.h>
  25 
  26 #include "bast.h"
  27 #include "simtec.h"
  28 
  29 static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
  30 {
  31         unsigned int val;
  32 
  33         val = __raw_readb(BAST_VA_CTRL3);
  34 
  35         printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
  36 
  37         if (vpp)
  38                 val |= BAST_CPLD_CTRL3_ROMWEN;
  39         else
  40                 val &= ~BAST_CPLD_CTRL3_ROMWEN;
  41 
  42         __raw_writeb(val, BAST_VA_CTRL3);
  43 }
  44 
  45 static struct physmap_flash_data simtec_nor_pdata = {
  46         .width          = 2,
  47         .set_vpp        = simtec_nor_vpp,
  48         .nr_parts       = 0,
  49 };
  50 
  51 static struct resource simtec_nor_resource[] = {
  52         [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
  53 };
  54 
  55 static struct platform_device simtec_device_nor = {
  56         .name           = "physmap-flash",
  57         .id             = -1,
  58         .num_resources  = ARRAY_SIZE(simtec_nor_resource),
  59         .resource       = simtec_nor_resource,
  60         .dev            = {
  61                 .platform_data = &simtec_nor_pdata,
  62         },
  63 };
  64 
  65 void __init nor_simtec_init(void)
  66 {
  67         int ret;
  68 
  69         ret = platform_device_register(&simtec_device_nor);
  70         if (ret < 0)
  71                 printk(KERN_ERR "failed to register physmap-flash device\n");
  72         else
  73                 simtec_nor_vpp(NULL, 1);
  74 }

/* [<][>][^][v][top][bottom][index][help] */