diff options
author | Vimal Singh <vimalsingh@ti.com> | 2010-02-15 13:03:33 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-02-15 13:03:33 -0500 |
commit | 2f70a1e93657bea0baa7d449aa49e44a08582dc8 (patch) | |
tree | 598f99ef54521cb3b82f0793d39753979e0a33ae /drivers | |
parent | 30e53bccfa15c6c0839c87705a66d478bb10baf5 (diff) |
omap2/3/4: Introducing 'gpmc-nand.c' for GPMC specific NAND init
Introducing 'gpmc-nand.c' for GPMC specific NAND init.
For example: GPMC timing parameters and all.
This patch also migrates gpmc related calls from 'nand/omap2.c'
to 'gpmc-nand.c'.
Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/omap2.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 1bb799f0125c..26aec0080184 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -30,12 +30,8 @@ | |||
30 | 30 | ||
31 | #define DRIVER_NAME "omap2-nand" | 31 | #define DRIVER_NAME "omap2-nand" |
32 | 32 | ||
33 | /* size (4 KiB) for IO mapping */ | ||
34 | #define NAND_IO_SIZE SZ_4K | ||
35 | |||
36 | #define NAND_WP_OFF 0 | 33 | #define NAND_WP_OFF 0 |
37 | #define NAND_WP_BIT 0x00000010 | 34 | #define NAND_WP_BIT 0x00000010 |
38 | #define WR_RD_PIN_MONITORING 0x00600000 | ||
39 | 35 | ||
40 | #define GPMC_BUF_FULL 0x00000001 | 36 | #define GPMC_BUF_FULL 0x00000001 |
41 | #define GPMC_BUF_EMPTY 0x00000000 | 37 | #define GPMC_BUF_EMPTY 0x00000000 |
@@ -882,8 +878,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
882 | struct omap_nand_info *info; | 878 | struct omap_nand_info *info; |
883 | struct omap_nand_platform_data *pdata; | 879 | struct omap_nand_platform_data *pdata; |
884 | int err; | 880 | int err; |
885 | unsigned long val; | ||
886 | |||
887 | 881 | ||
888 | pdata = pdev->dev.platform_data; | 882 | pdata = pdev->dev.platform_data; |
889 | if (pdata == NULL) { | 883 | if (pdata == NULL) { |
@@ -905,28 +899,14 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
905 | info->gpmc_cs = pdata->cs; | 899 | info->gpmc_cs = pdata->cs; |
906 | info->gpmc_baseaddr = pdata->gpmc_baseaddr; | 900 | info->gpmc_baseaddr = pdata->gpmc_baseaddr; |
907 | info->gpmc_cs_baseaddr = pdata->gpmc_cs_baseaddr; | 901 | info->gpmc_cs_baseaddr = pdata->gpmc_cs_baseaddr; |
902 | info->phys_base = pdata->phys_base; | ||
908 | 903 | ||
909 | info->mtd.priv = &info->nand; | 904 | info->mtd.priv = &info->nand; |
910 | info->mtd.name = dev_name(&pdev->dev); | 905 | info->mtd.name = dev_name(&pdev->dev); |
911 | info->mtd.owner = THIS_MODULE; | 906 | info->mtd.owner = THIS_MODULE; |
912 | 907 | ||
913 | err = gpmc_cs_request(info->gpmc_cs, NAND_IO_SIZE, &info->phys_base); | 908 | info->nand.options |= pdata->devsize ? NAND_BUSWIDTH_16 : 0; |
914 | if (err < 0) { | 909 | info->nand.options |= NAND_SKIP_BBTSCAN; |
915 | dev_err(&pdev->dev, "Cannot request GPMC CS\n"); | ||
916 | goto out_free_info; | ||
917 | } | ||
918 | |||
919 | /* Enable RD PIN Monitoring Reg */ | ||
920 | if (pdata->dev_ready) { | ||
921 | val = gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG1); | ||
922 | val |= WR_RD_PIN_MONITORING; | ||
923 | gpmc_cs_write_reg(info->gpmc_cs, GPMC_CS_CONFIG1, val); | ||
924 | } | ||
925 | |||
926 | val = gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG7); | ||
927 | val &= ~(0xf << 8); | ||
928 | val |= (0xc & 0xf) << 8; | ||
929 | gpmc_cs_write_reg(info->gpmc_cs, GPMC_CS_CONFIG7, val); | ||
930 | 910 | ||
931 | /* NAND write protect off */ | 911 | /* NAND write protect off */ |
932 | omap_nand_wp(&info->mtd, NAND_WP_OFF); | 912 | omap_nand_wp(&info->mtd, NAND_WP_OFF); |
@@ -934,7 +914,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
934 | if (!request_mem_region(info->phys_base, NAND_IO_SIZE, | 914 | if (!request_mem_region(info->phys_base, NAND_IO_SIZE, |
935 | pdev->dev.driver->name)) { | 915 | pdev->dev.driver->name)) { |
936 | err = -EBUSY; | 916 | err = -EBUSY; |
937 | goto out_free_cs; | 917 | goto out_free_info; |
938 | } | 918 | } |
939 | 919 | ||
940 | info->nand.IO_ADDR_R = ioremap(info->phys_base, NAND_IO_SIZE); | 920 | info->nand.IO_ADDR_R = ioremap(info->phys_base, NAND_IO_SIZE); |
@@ -963,11 +943,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
963 | info->nand.chip_delay = 50; | 943 | info->nand.chip_delay = 50; |
964 | } | 944 | } |
965 | 945 | ||
966 | info->nand.options |= NAND_SKIP_BBTSCAN; | ||
967 | if ((gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG1) & 0x3000) | ||
968 | == 0x1000) | ||
969 | info->nand.options |= NAND_BUSWIDTH_16; | ||
970 | |||
971 | if (use_prefetch) { | 946 | if (use_prefetch) { |
972 | /* copy the virtual address of nand base for fifo access */ | 947 | /* copy the virtual address of nand base for fifo access */ |
973 | info->nand_pref_fifo_add = info->nand.IO_ADDR_R; | 948 | info->nand_pref_fifo_add = info->nand.IO_ADDR_R; |
@@ -1043,8 +1018,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
1043 | 1018 | ||
1044 | out_release_mem_region: | 1019 | out_release_mem_region: |
1045 | release_mem_region(info->phys_base, NAND_IO_SIZE); | 1020 | release_mem_region(info->phys_base, NAND_IO_SIZE); |
1046 | out_free_cs: | ||
1047 | gpmc_cs_free(info->gpmc_cs); | ||
1048 | out_free_info: | 1021 | out_free_info: |
1049 | kfree(info); | 1022 | kfree(info); |
1050 | 1023 | ||