Skip to content
  1. Nov 27, 2012
  2. Nov 24, 2012
  3. Nov 23, 2012
    • Thomas Petazzoni's avatar
      dma: mv_xor: fix error handling path · 73d9cdca
      Thomas Petazzoni authored
      
      
      The ->probe() function of the mv_xor function contains in its error
      handling code a loop to cleanup the XOR channels that had been
      successfully initialized if some other XOR channel fails to be
      initialized. It does that by traveling the list of XOR channels, and
      cleanup those for which the pointer is not NULL.
      
      However, since the mv_xor_channel_add() function return a PTR_ERR
      style value, the pointer is not NULL on error. So, when handling the
      error of a given channel initialization, we cleanup this channel
      initialization and mark this channel entry as NULL in the array. This
      allows the remaining of the cleanup (for other channels) to work
      properly.
      
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      73d9cdca
    • Thomas Petazzoni's avatar
      dma: mv_xor: fix error checking of irq_of_parse_and_map() · f8eb9e7d
      Thomas Petazzoni authored
      
      
      The irq_of_parse_and_map() function returns 0 on failure, and does not
      return an error code, so we fix the calling site of
      irq_of_parse_and_map() in the mv_xor driver.
      
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      f8eb9e7d
    • Thomas Petazzoni's avatar
      dma: mv_xor: use request_irq() instead of devm_request_irq() · 2d0a0745
      Thomas Petazzoni authored
      
      
      Even through the usage of devm_*() functions is generally recommended
      over their classic variants, in the case of devm_request_irq()
      combined with irq_of_parse_and_map(), it doesn't work nicely.
      
      We have the following scenario:
      
       irq_of_parse_and_map(...)
       devm_request_irq(...)
      
      For some reason, the driver initialization fails at a later
      point. Since irq_of_parse_and_map() is no device-managed, we do a:
      
       irq_dispose_mapping(...)
      
      Unfortunately, this doesn't work, because the free_irq() must be done
      prior to calling irq_dispose_mapping(). But with the devm mechanism,
      the automatic free_irq() would happen only after we get out of the
      ->probe() function.
      
      So basically, we revert to using request_irq() with traditional error
      handling, so that in case of error, free_irq() gets called before
      irq_dispose_mapping().
      
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      2d0a0745
    • Thomas Petazzoni's avatar
      dma: mv_xor: clear the window override control registers · c4b4b732
      Thomas Petazzoni authored
      
      
      The XOR channels on Marvell SoCs have a Window Override Control
      register that allow to do some fancy things with addresses. Those
      features are not used by the driver, but some U-Boot versions anyway
      modify those registers.
      
      For some reason, the U-Boot on OpenBlocks AX3-4 was setting an invalid
      value in those registers when the addition 2 GB DRAM chip was plugged
      into the board, causing the XOR driver to fail in using the XOR
      engines.
      
      By setting those registers to 0 during the driver initialization, we
      ensure that the registers are configured according with the driver
      operation model.
      
      Thanks to Lior Amsalem <alior@marvell.com> for his help in debugging
      this problem.
      
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      c4b4b732
    • Thomas Petazzoni's avatar
      arm: mvebu: fix address decoding armada_cfg_base() function · 9f3410ff
      Thomas Petazzoni authored
      
      
      The armada_cfg_base() function returns the base address of the
      registers that allow to configure the decoding for a particular
      address window. On Armada 370/XP, the lower windows have more
      configuration registers (4 registers) than the higher windows (2
      registers). This armada_cfg_base() takes this into account by doing a
      different offset calculation depending on the window number, but this
      offset calculation was wrong for the higher windows.
      
      Even though we were not using high window numbers until now (only
      window 0 is used to map the BootROM, needed for SMP), we use this
      function at boot time to disable all windows to ensure that nothing
      remains intialized from what the bootloader has done.
      
      Unfortunately, the U-Boot on the OpenBlocks AX3-4 uses a window with a
      high number (above 8) to remap the BootROM. And then when the kernel
      boots, it remaps the BootROM in window 0. Normally, this is not a
      problem, because all windows have previously been disabled. Except
      that due to our wrong offset calculation, the windows with high
      numbers were not properly disabled, leading to the BootROM being
      mapped twice. The visible result of this bug was that the kernel was
      unable to get the second CPU started on the OpenBlocks AX3-4
      platform. With this fix, all windows are properly cleared at boot
      time, the BootROM is remapped only once in window 0, and the second
      CPU boots fine.
      
      Thanks a lot to Lior Amsamlen <alior@marvell.com> for his help in
      debugging this problem.
      
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      ---
      Strictly speaking, this bug was introduced in 3.7, but since the only
      platforms supported in 3.7 were Armada 370 and Armada XP, and there
      was anyway no SMP support at this time, it isn't really worth the
      effort to push this patch in 3.7.
      9f3410ff
  4. Nov 22, 2012
  5. Nov 21, 2012