1. 15 Dec, 2011 16 commits
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Remove omap_uart_can_sleep and add pm_qos · 2fd14964
      Govindraj.R authored
      Omap_uart_can_sleep function blocks system wide low power state until
      uart is active remove this func and add qos requests to prevent
      MPU from transitioning.
      
      Keep qos request to default value which will allow MPU to transition
      and while uart baud rate is available calculate the latency value
      from the baudrate and use the same to hold constraint while uart clocks
      are enabled, and if uart is auto-idled the constraint is updated with
      default constraint value allowing MPU to transition.
      
      Qos requests are blocking notifier calls so put these requests to
      work queue, also the driver uses irq_safe version of runtime API's
      and callbacks can be called in interrupt disabled context.
      So to avoid warn on slow path warning while using qos update
      API's from runtime callbacks use the qos_work_queue.
      
      During bootup the runtime_resume call backs might not be called and runtime
      callback gets called only after uart is idled by setting the autosuspend
      timeout. So qos_request from runtime resume callback might not activated during
      boot if uart baudrate is calculated during bootup for console uart, so schedule
      the qos_work queue once we calc_latency while configuring the uart port.
      
      Flush and complete any pending qos jobs in work queue while suspending.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      2fd14964
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Do not gate uart clocks if used for debug_prints · 36fc2d15
      Govindraj.R authored
      If OMAP UART is used as console uart and debug is enabled,
      avoid gating of uart clocks to print all debug prints.
      
      If uart clocks are gated then the debug prints from omap_device
      framework or hwmod framework can cause uart to enter recursive
      pm_runtime calls, which can cause a deadlock over power lock usage.
      
      For example: Say, uart clocks are cut and we get a print from
      omap_device_disable stating disabling uart clocks. This print
      calls omap_uart driver console_write which will call runtime API
      get_sync which means we enter from runtime API put context to
      runtime API get context.
      
      --> runtime put (take power lock)
          --> print disabling uart clocks
              --> call uart console write
                  --> call get_sync (try to take power lock)
      
      Also any clock enable API call from uart driver should not call any uart
      operation until clocks are enabled back. Like get_sync having debug print
      calling uart console write even before clocks are enabled.
      
      So to avoid these scenarios, identify from bootargs if OMAP_UART(ttyO) is used
      in debug mode. If so, do not set device_may_wakeup. This will prevent
      pm_runtime_enable in uart driver and will avoid uart clock gating.
      Debug is enabled either by adding debug word in bootarg or by setting
      loglevel=10
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      36fc2d15
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Avoid uart idling on suspend for no_console_suspend usecase · 08f86b3e
      Govindraj.R authored
      If no_console_suspend is used we have prevent uart idling during suspend
      to provide debug prints.
      
      Power domain hooks can idle uarts if left enabled during system wide suspend
      so re-use the omap_device_disable_idle_on_suspend API's to ensure console_uart
      is not idled during suspend.
      
      omap_device_disable_idle_on_suspend API was used on all uarts since the uart
      driver was not runtime adapted, now with runtime adaptation we can re-use this
      API only for no_console_suspend use cases.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      08f86b3e
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Avoid console uart idling during bootup · 8612bd22
      Govindraj.R authored
      Omap-uart can be used as console uart to print early boot messages using
      earlyprintk so for console uart prevent hwmod reset or idling during bootup.
      
      Identify omap-uart used as console and avoid idling rather than preventing
      all omap-uarts from idling during bootup. Update the comments for the same.
      
      Remove the uart idling and enabling back using hwmod_idle/omap_device_enable
      for all uarts that where left enabled from boot to set the hwmod framework
      state machine right. This need not be taken care any more serial.c rather
      can be handled within the hwmod framework.
      Reference: http://www.spinics.net/lists/linux-omap/msg60300.htmlSigned-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      8612bd22
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: remove temporary variable used to count uart instance · 969996a5
      Govindraj.R authored
      Reuse the num_uarts variable itself to count number of uarts.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      969996a5
    • Jon Hunter's avatar
      ARM: OMAP2+: UART: Make the RX_TIMEOUT for DMA configurable for each UART · a9e210e0
      Jon Hunter authored
      When using DMA there are two timeouts defined. The first timeout,
      rx_timeout, is really a polling rate in which software polls the
      DMA status to see if the DMA has finished. This is necessary for
      the RX side because we do not know how much data we will receive.
      The secound timeout, RX_TIMEOUT, is a timeout after which the
      DMA will be stopped if no more data is received. To make this
      clearer, rename rx_timeout as rx_poll_rate and rename the
      function serial_omap_rx_timeout() to serial_omap_rxdma_poll().
      
      The OMAP-Serial driver defines an RX_TIMEOUT of 3 seconds that is
      used to indicate when the DMA for UART can be stopped if no more
      data is received. The value is a global definition that is applied
      to all instances of the UART.
      
      Each UART may be used for a different purpose and so the timeout
      required may differ. Make this value configurable for each UART so
      that this value can be optimised for power savings.
      Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      a9e210e0
    • Deepak K's avatar
      ARM: OMAP2+: UART: Allow UART parameters to be configured from board file. · c86845db
      Deepak K authored
      The following UART parameters are defined within the UART driver:
      
      1). Whether the UART uses DMA (dma_enabled), by default set to 0
      2). The size of dma buffer (set to 4096 bytes)
      3). The time after which the dma should stop if no more data is received.
      4). The auto suspend delay that will be passed for pm_runtime_autosuspend
          where uart will be disabled after timeout
      
      Different UARTs may be used for different purpose such as the console,
      for interfacing bluetooth chip, for interfacing to a modem chip, etc.
      Therefore, it is necessary to be able to customize the above settings
      for a given board on a per UART basis.
      
      This change allows these parameters to be configured from the board file
      and allows the parameters to be configured for each UART independently.
      
      If a board does not define its own custom parameters for the UARTs, then
      use the default parameters in the structure "omap_serial_default_info".
      The default parameters are defined to be the same as the current settings
      in the UART driver to avoid breaking the UART for any cuurnelty supported
      boards. By default, make all boards use the default UART parameters.
      Signed-off-by: default avatarDeepak K <deepak.k@ti.com>
      Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      c86845db
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Remove old and unused clocks handling funcs · 634bd6e4
      Govindraj.R authored
      With runtime adaptation done remove clock_enable/disbale API's
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      634bd6e4
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Add wakeup mechanism for omap-uarts · 62f3ec5f
      Govindraj.R authored
      From the runtime callbacks enable hwmod wakeups for uart which will
      internally enable io-pad wakeups for uarts if they have rx-pad pins
      set as wakeup capabale.
      
      Use the io-ring wakeup mechanism after uart clock gating and leave
      the PM_WKST set for uart to default reset values cleanup the
      code in serial.c which was handling PM_WKST reg.
      Irq_chaing(PRM_DRIVER) is used to wakeup uart after uart clocks are gated
      using pad wakeup mechanism.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      62f3ec5f
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Move errata handling from serial.c to omap-serial · 94734749
      Govindraj.R authored
      Move the errata handling mechanism from serial.c to omap-serial file
      and utilise the same func in driver file.
      
      Errata i202, i291 are moved to be handled with omap-serial
      Moving the errata macro from serial.c file to driver header file
      as from on errata will be handled in driver file itself.
      Corrected errata id from chapter reference 2.15 to errata id i291.
      
      Removed errata and dma_enabled fields from omap_uart_state struct
      as they are no more needed with errata handling done within omap-serial.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: default avatarAlan Cox <alan@linux.intel.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      94734749
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Get context loss count to context restore · ec3bebc6
      Govindraj.R authored
      Avoid unconditional context restore every time we gate uart
      clocks. Check whether context loss happened based on which
      we can context restore uart regs from uart_port structure.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      ec3bebc6
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Remove uart reset function. · 32212897
      Govindraj.R authored
      Remove the uart reset function which is configuring the
      TX empty irq which can now be handled within omap-serial driver.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      32212897
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Ensure all reg values configured are available from port structure · c538d20c
      Govindraj.R authored
      Add missing uart regs to uart_port structure which can be used in
      context restore. Store dll, dlh, mdr1, scr, efr, lcr, mcr reg values
      into uart_port structure while configuring individual port in termios
      function.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      c538d20c
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Remove context_save and move context restore to driver · 9f9ac1e8
      Govindraj.R authored
      Remove context save function from serial.c and move context restore
      function to omap-serial. Remove all regs stored in omap_uart_state
      for contex_save/restore, reg read write funcs used in context_save/restore,
      io_addresses populated for read/write funcs.
      
      Clock gating mechanism was done in serial.c and had no info on uart state
      thus we needed context save and restore in serial.c
      With runtime conversion and clock gating done within uart driver
      context restore can be done from regs value available from uart_omap_port
      structure.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      9f9ac1e8
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Add runtime pm support for omap-serial driver · fcdca757
      Govindraj.R authored
      Adapts omap-serial driver to use pm_runtime API's.
      Use runtime runtime API's to handle uart clocks and obtain
      device_usage statics. Set runtime API's usage to irq_safe so that
      we can use get_sync from irq context. Auto-suspend for port specific
      activities and put for reg access. Moving suspend/resume hooks
      to dev_pm_ops structure and bind with config_suspend to avoid any
      compilation warning if config_suspend is disabled.
      
      By default uart autosuspend delay is set to -1 to avoid character loss
      if uart's are autoidled and woken up on rx pin.
      
      After boot up UART's can be autoidled by setting autosuspend delay from sysfs.
      
      echo 3000 > /sys/devices/platform/omap/omap_uart.X/power/autosuspend_delay_ms
      X=0,1,2,3 for UART1/2/3/4. Number of uarts available may vary across omap_soc.
      
      Also if uart is not wakeup capable we can prevent runtime autosuspend by
      forbiding runtime.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: default avatarAlan Cox <alan@linux.intel.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      fcdca757
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Remove mapbase/membase fields from pdata. · edd70ad7
      Govindraj.R authored
      The mapbase (start_address), membase(io_remap cookie) part of
      pdata struct omap_uart_port_info are removed as this should be
      derived within driver.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      edd70ad7
  2. 14 Dec, 2011 4 commits
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Add default mux for all uarts. · 7496ba30
      Govindraj.R authored
      Padconf wakeup is used to wakeup uart after uart fclks/iclks are gated.
      Rx-Pad wakeup was done by writing to rx-pad offset value populated in
      serial.c idle_init. Remove the direct reading and writing into rx pad.
      Remove the padconf field part of omap_uart_state struct and pad offsets
      populated.
      
      Now with mux framework support we can use mux_utilities
      along with hmwod framework to handle io-pad configuration and enable rx-pad
      wake-up mechanism.
      
      To avoid breaking any board support add default mux data for all uart's
      if mux info is not passed from board file.
      With the default pads populated in serial.c wakeup capability for
      rx pads is set, this can be used to enable uart_rx io-pad wakeup from
      hwmod framework. The pad values in 3430sdp/4430sdp/omap4panda board file
      are same as the default pad values populated in serial.c. Remove pad values
      from 3430sdp/4430sdp/omap4panda board file and use the default pads
      from serial.c file.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      7496ba30
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: Cleanup part of clock gating mechanism for uart · 273558b3
      Govindraj.R authored
      Currently we use a shared irq handler to identify uart activity and then
      trigger a timer. By default the timeout value is zero and can be set or
      modified from sysfs. If there was no uart activity for the period set
      through sysfs, the timer will expire and call timer handler this will
      set a flag can_sleep using which decision to gate uart clocks can be taken.
      
      Since the clock gating mechanism is outside the uart driver, we currently
      use this mechanism. In preparation to runtime implementation for omap-serial
      driver we can cleanup this mechanism and use runtime API's to gate uart clocks.
      
      Removes the following:
      * timer related info from local uart_state struct
      * the code used to set timeout value from sysfs.
      * irqflags used to set shared irq handler.
      * un-used function omap_uart_check_wakeup.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      273558b3
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: cleanup 8250 console driver support · 8a605851
      Govindraj.R authored
      We had been using traditional 8250 driver as uart console driver
      prior to omap-serial driver. Since we have omap-serial driver
      in mainline kernel for some time now it has been used as default
      uart console driver on omap2+ platforms. Remove 8250 support for
      omap-uarts.
      
      Serial_in and serial_out override for 8250 serial driver is also
      removed. Empty fifo read fix is already taken care with omap-serial
      driver with data ready bit check from LSR reg before reading RX fifo.
      Also waiting for THRE(transmit hold reg empty) is done with wait_for_xmitr
      in omap-serial driver.
      
      Serial_in/out overrides are not neceesary for omap-serial driver
      and things that are taken with omap-serial driver are removed here.
      
      Remove headers that were necessary to support 8250 support
      and remove all config bindings done to keep 8250 backward compatibility
      while adding omap-serial driver. Remove omap_uart_reset needed for
      8250 autoconf.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      8a605851
    • Govindraj.R's avatar
      ARM: OMAP2+: UART: cleanup + remove uart pm specific API · 8384c974
      Govindraj.R authored
      In preparation to UART runtime conversion remove uart specific calls
      from pm24xx/34xx files and their definition from serial.c
      These func calls will no more be used with upcoming uart runtime design.
      
      1.) omap_uart_prepare_suspend :- can be taken care with driver suspend hooks.
      2.) omap_uart_enable_irqs :- Used to enable/disable uart irq's in suspend
          path from PM code, this is removed as same is handled by
          uart_suspend_port/uart_resume_port in omap-serial driver which will
          do an port_shutdown on suspend freeing irq and port_startup on resume
          enabling back irq.
      3.) Remove prepare_idle/resume_idle calls used to gate uart clocks.
          UART clocks can be gated within driver using runtime funcs
          and be woken up using irq_chaining from omap_prm driver.
      4.) Remove console_locking from idle path as clock gating is done withing
          driver itself with runtime API. Remove is_suspending check used to acquire
          console_lock.
      Signed-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      8384c974
  3. 13 Dec, 2011 6 commits
  4. 06 Dec, 2011 2 commits
  5. 05 Dec, 2011 4 commits
  6. 03 Dec, 2011 1 commit
  7. 02 Dec, 2011 7 commits