Lines Matching refs:p
65 static void vr_nor_destroy_partitions(struct vr_nor_mtd *p) in vr_nor_destroy_partitions() argument
67 mtd_device_unregister(p->info); in vr_nor_destroy_partitions()
70 static int vr_nor_init_partitions(struct vr_nor_mtd *p) in vr_nor_init_partitions() argument
74 return mtd_device_register(p->info, NULL, 0); in vr_nor_init_partitions()
77 static void vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) in vr_nor_destroy_mtd_setup() argument
79 map_destroy(p->info); in vr_nor_destroy_mtd_setup()
82 static int vr_nor_mtd_setup(struct vr_nor_mtd *p) in vr_nor_mtd_setup() argument
88 for (type = probe_types; !p->info && *type; type++) in vr_nor_mtd_setup()
89 p->info = do_map_probe(*type, &p->map); in vr_nor_mtd_setup()
90 if (!p->info) in vr_nor_mtd_setup()
93 p->info->dev.parent = &p->dev->dev; in vr_nor_mtd_setup()
98 static void vr_nor_destroy_maps(struct vr_nor_mtd *p) in vr_nor_destroy_maps() argument
103 exp_timing_cs0 = readl(p->csr_base + EXP_TIMING_CS0); in vr_nor_destroy_maps()
105 writel(exp_timing_cs0, p->csr_base + EXP_TIMING_CS0); in vr_nor_destroy_maps()
108 iounmap(p->map.virt); in vr_nor_destroy_maps()
111 iounmap(p->csr_base); in vr_nor_destroy_maps()
118 static int vr_nor_init_maps(struct vr_nor_mtd *p) in vr_nor_init_maps() argument
125 csr_phys = pci_resource_start(p->dev, EXP_CSR_MBAR); in vr_nor_init_maps()
126 csr_len = pci_resource_len(p->dev, EXP_CSR_MBAR); in vr_nor_init_maps()
127 win_phys = pci_resource_start(p->dev, EXP_WIN_MBAR); in vr_nor_init_maps()
128 win_len = pci_resource_len(p->dev, EXP_WIN_MBAR); in vr_nor_init_maps()
136 p->csr_base = ioremap(csr_phys, csr_len); in vr_nor_init_maps()
137 if (!p->csr_base) in vr_nor_init_maps()
140 exp_timing_cs0 = readl(p->csr_base + EXP_TIMING_CS0); in vr_nor_init_maps()
142 dev_warn(&p->dev->dev, "Expansion Bus Chip Select 0 " in vr_nor_init_maps()
148 dev_warn(&p->dev->dev, "Expansion Bus Chip Select 0 " in vr_nor_init_maps()
151 p->map.name = DRV_NAME; in vr_nor_init_maps()
152 p->map.bankwidth = (exp_timing_cs0 & TIMING_BYTE_EN) ? 1 : 2; in vr_nor_init_maps()
153 p->map.phys = win_phys + CS0_START; in vr_nor_init_maps()
154 p->map.size = CS0_SIZE; in vr_nor_init_maps()
155 p->map.virt = ioremap(p->map.phys, p->map.size); in vr_nor_init_maps()
156 if (!p->map.virt) { in vr_nor_init_maps()
160 simple_map_init(&p->map); in vr_nor_init_maps()
164 writel(exp_timing_cs0, p->csr_base + EXP_TIMING_CS0); in vr_nor_init_maps()
169 iounmap(p->csr_base); in vr_nor_init_maps()
180 struct vr_nor_mtd *p = pci_get_drvdata(dev); in vr_nor_pci_remove() local
182 vr_nor_destroy_partitions(p); in vr_nor_pci_remove()
183 vr_nor_destroy_mtd_setup(p); in vr_nor_pci_remove()
184 vr_nor_destroy_maps(p); in vr_nor_pci_remove()
185 kfree(p); in vr_nor_pci_remove()
192 struct vr_nor_mtd *p = NULL; in vr_nor_pci_probe() local
204 p = kzalloc(sizeof(*p), GFP_KERNEL); in vr_nor_pci_probe()
206 if (!p) in vr_nor_pci_probe()
209 p->dev = dev; in vr_nor_pci_probe()
211 err = vr_nor_init_maps(p); in vr_nor_pci_probe()
215 err = vr_nor_mtd_setup(p); in vr_nor_pci_probe()
219 err = vr_nor_init_partitions(p); in vr_nor_pci_probe()
223 pci_set_drvdata(dev, p); in vr_nor_pci_probe()
228 map_destroy(p->info); in vr_nor_pci_probe()
232 exp_timing_cs0 = readl(p->csr_base + EXP_TIMING_CS0); in vr_nor_pci_probe()
234 writel(exp_timing_cs0, p->csr_base + EXP_TIMING_CS0); in vr_nor_pci_probe()
237 iounmap(p->map.virt); in vr_nor_pci_probe()
240 iounmap(p->csr_base); in vr_nor_pci_probe()
243 kfree(p); in vr_nor_pci_probe()