jffs & amd_flash.c

Kugan kugan at mediasolv.com
Sun Sep 16 23:16:38 EDT 2001


Hi All
I am new to this mailing list.
I have uClinux 2.0.38 kernel running on Atmel EB63 Evaluation board, there I
have ATMEL AT491604 90 TC flash.  I have partitioned the flash with pnc2000.
after mounting the jffs when i try to create a file on the partitione it is
going into this function and adding the task to waiq and calling and
schedule and seems it is struck there,
Where does this waitq consumed and what could be the mistake????
Thanx in Advance

Kugan

tatic int write_one_word(struct map_info *map, struct flchip *chip,
     unsigned long adr, __u32 datum)
{
 unsigned long timeo = jiffies + HZ;
 struct amd_flash_private *private = map->fldrv_priv;
 DECLARE_WAITQUEUE(wait, current);
 int ret = 0;
 int times_left;

retry:
 spin_lock_bh(chip->mutex);

 if (chip->state != FL_READY){
  printk("%s: waiting for chip to write, state = %d\n",
         map->name, chip->state);
  set_current_state(TASK_UNINTERRUPTIBLE);
  add_wait_queue(&chip->wq, &wait);

  spin_unlock_bh(chip->mutex);

  schedule();
  remove_wait_queue(&chip->wq, &wait);
  printk(KERN_INFO "%s: woke up to write\n", map->name);
  if(signal_pending(current))
   return -EINTR;

  timeo = jiffies + HZ;

  goto retry;
 }

 chip->state = FL_WRITING;

 adr += chip->start;
 ENABLE_VPP(map);
 send_cmd(map, chip->start, CMD_PROGRAM_UNLOCK_DATA);
 wide_write(map, datum, adr);

 times_left = 500000;
 while (times_left-- && flash_is_busy(map, adr, private->interleave))

  if (current->need_resched) {
   spin_unlock_bh(chip->mutex);
   schedule();
   spin_lock_bh(chip->mutex);
  }
 }

 if (!times_left) {
  printk(KERN_WARNING "%s: write to 0x%lx timed out!\n",
         map->name, adr);
  ret = -EIO;
 } else {
  __u32 verify;
  if ((verify = wide_read(map, adr)) != datum) {
   printk(KERN_WARNING "%s: write to 0x%lx failed. "
          "datum = %x, verify = %x\n",
          map->name, adr, datum, verify);
   ret = -EIO;
  }
 }

 DISABLE_VPP(map);
 chip->state = FL_READY;
 wake_up(&chip->wq);
 spin_unlock_bh(chip->mutex);

 return ret;
}






More information about the linux-mtd mailing list