• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/mtd/maps/

Lines Matching defs:state

49 static void switch_to_flash(struct async_state *state)
51 local_irq_save(state->irq_flags);
53 gpio_set_value(state->enet_flash_pin, 0);
55 state->save_ambctl0 = bfin_read_EBIU_AMBCTL0();
56 state->save_ambctl1 = bfin_read_EBIU_AMBCTL1();
57 bfin_write_EBIU_AMBCTL0(state->flash_ambctl0);
58 bfin_write_EBIU_AMBCTL1(state->flash_ambctl1);
62 static void switch_back(struct async_state *state)
64 bfin_write_EBIU_AMBCTL0(state->save_ambctl0);
65 bfin_write_EBIU_AMBCTL1(state->save_ambctl1);
68 gpio_set_value(state->enet_flash_pin, 1);
70 local_irq_restore(state->irq_flags);
75 struct async_state *state = (struct async_state *)map->map_priv_1;
79 switch_to_flash(state);
83 switch_back(state);
91 struct async_state *state = (struct async_state *)map->map_priv_1;
93 switch_to_flash(state);
97 switch_back(state);
102 struct async_state *state = (struct async_state *)map->map_priv_1;
107 switch_to_flash(state);
112 switch_back(state);
117 struct async_state *state = (struct async_state *)map->map_priv_1;
119 switch_to_flash(state);
124 switch_back(state);
137 struct async_state *state;
139 state = kzalloc(sizeof(*state), GFP_KERNEL);
140 if (!state)
143 state->map.name = DRIVER_NAME;
144 state->map.read = bfin_flash_read;
145 state->map.copy_from = bfin_flash_copy_from;
146 state->map.write = bfin_flash_write;
147 state->map.copy_to = bfin_flash_copy_to;
148 state->map.bankwidth = pdata->width;
149 state->map.size = memory->end - memory->start + 1;
150 state->map.virt = (void __iomem *)memory->start;
151 state->map.phys = memory->start;
152 state->map.map_priv_1 = (unsigned long)state;
153 state->enet_flash_pin = platform_get_irq(pdev, 0);
154 state->flash_ambctl0 = flash_ambctl->start;
155 state->flash_ambctl1 = flash_ambctl->end;
157 if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) {
158 pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin);
159 kfree(state);
162 gpio_direction_output(state->enet_flash_pin, 1);
164 pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8);
165 state->mtd = do_map_probe(memory->name, &state->map);
166 if (!state->mtd) {
167 gpio_free(state->enet_flash_pin);
168 kfree(state);
173 ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0);
176 add_mtd_partitions(state->mtd, pdata->parts, ret);
177 state->parts = pdata->parts;
181 add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts);
187 add_mtd_device(state->mtd);
190 platform_set_drvdata(pdev, state);
197 struct async_state *state = platform_get_drvdata(pdev);
198 gpio_free(state->enet_flash_pin);
200 del_mtd_partitions(state->mtd);
201 kfree(state->parts);
203 map_destroy(state->mtd);
204 kfree(state);