1. 26 6月, 2016 3 次提交
  2. 01 5月, 2016 2 次提交
    • S
      tty: serial: msm: Support more bauds · 98952bf5
      Stephen Boyd 提交于
      The msm_find_best_baud() function is written with the assumption
      that the port->uartclk rate is fixed to a particular rate at boot
      time, but now this driver changes that clk rate at runtime when
      the baud is changed.
      
      The way the hardware works is that an input clk rate comes from
      the clk controller into the uart hw block. That rate is typically
      1843200 or 3686400 Hz. That rate can then be divided by an
      internal divider in the hw block to achieve a particular baud on
      the serial wire. msm_find_best_baud() is looking for that divider
      value.
      
      A few things are wrong with the way the code is written. First,
      it assumes that the maximum baud that the uart can support if the
      clk rate is fixed at boot is 460800, which would correspond to an
      input clk rate of 230400 * 16 == 3686400 Hz.  Except some devices
      have a boot rate of 1843200 Hz or max baud of 115200, so
      achieving 230400 on those devices doesn't work at all because we
      don't increase the clk rate unless max baud is 460800.
      
      Second, we can't achieve bauds higher than 460800 that require
      anything besides a divisor of 1, because we always call
      msm_find_best_baud() with a fixed port->uartclk rate that will
      eventually be changed after we calculate the divisor. So if we
      need to get a baud of 500000, we'll just multiply that by 16 and
      hope that the clk can give us 500000 * 16 == 8000000 Hz, which it
      typically can't do. To really achieve 500000 baud, we need to get
      an input clk rate of 24000000 Hz and then divide that by 3 inside
      the uart hardware.
      
      Finally, we return success for bauds even when we can't actually
      achieve them. This means that when the user asks for 500000 baud,
      we actually get 921600 right now, but the user doesn't know that.
      
      Fix all of this by searching through the divisor and clk rate
      space with a combination of clk_round_rate() and baud
      calculations, keeping track of the best clk rate and divisor we
      find if we can't get an exact match. Typically we can get an
      exact match with a divisor of 1, but sometimes we need to keep
      track and try more frequencies. On my msm8916 device, this
      results in all standard bauds in baud_table being supported
      except for 1800, 576000, 1152000, and 4000000.
      
      Fixes: 850b37a7 ("tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation")
      Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com>
      Cc: Matthew McClintock <mmcclint@codeaurora.org>
      Signed-off-by: NStephen Boyd <stephen.boyd@linaro.org>
      Tested-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Acked-by: NAndy Gross <andy.gross@linaro.org>
      Acked-by: NBjorn Andersson <bjorn.andersson@linaro.org>
      Tested-by: NCristian Prundeanu <cprundea@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98952bf5
    • S
      tty: msm_serial: remove static clk rate setting in probe · 79c9473f
      Srinivas Kandagatla 提交于
      The issue with setting up a fixed clock rate at probe is that it would
      overwrite the console rate set by the bootloader for its console device.
      This would result in serial out corruption or missing log when we system
      is booted with earlycon. This is not a issue if we boot system without
      earlycon.
      
      This setup is at least not required with the mainline driver, this code
      used to be required because the clk_enable() call would fail if
      clk_set_rate() wasn't called first.
      
      Originally the issue was noticed on DB410c which is based on APQ8016
      chipset.
      
      Without this patch the console log with earlycon would look like:
      ...
      [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
      [    0.000000] NR_IRQS:64 nr_irqs:64 0
      ����+HH��0.699378] console [ttyMSM0] enabled
      [    0.699378] console [ttyMSM0] enabled
      [    0.702003] bootconsole [uart0] disabled
      [    0.702003] bootconsole [uart0] disabled
      ...
      
      with this patch I can see all the skipped lines on the console
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Acked-by: NAndy Gross <andy.gross@linaro.org>
      Tested-by: NPramod Gurav <gpramod@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79c9473f
  3. 07 2月, 2016 1 次提交
    • P
      earlycon: Use common framework for earlycon declarations · 2eaa7909
      Peter Hurley 提交于
      Use a single common table of struct earlycon_id for both command line
      and devicetree. Re-define OF_EARLYCON_DECLARE() macro to instance a
      unique earlycon declaration (the declaration is only guaranteed to be
      unique within a compilation unit; separate compilation units must still
      use unique earlycon names).
      
      The semantics of OF_EARLYCON_DECLARE() is different; it declares an
      earlycon which can matched either on the command line or by devicetree.
      EARLYCON_DECLARE() is semantically unchanged; it declares an earlycon
      which is matched by command line only. Remove redundant instances of
      EARLYCON_DECLARE().
      
      This enables all earlycons to properly initialize struct console
      with the appropriate name and index, which improves diagnostics and
      enables direct earlycon-to-console handoff.
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2eaa7909
  4. 05 10月, 2015 5 次提交
  5. 03 2月, 2015 2 次提交
  6. 25 11月, 2014 1 次提交
  7. 07 11月, 2014 4 次提交
    • S
      tty: serial: msm_serial: Use DT aliases · 97f75471
      Stephen Boyd 提交于
      We rely on probe order of this driver to determine the line number for
      the uart port. This makes it impossible to know the line number
      when these devices are populated via DT. Use the DT alias
      mechanism to assign the line based on the aliases node.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97f75471
    • S
      tty: serial: msm: Reset uartdm after baud rate change · a12f1b40
      Stephen Boyd 提交于
      We need to issue a reset if we ever change the value of the IPR
      register on DM hardware. If we don't reset the hardware the RX
      stale interrupt never triggers and the only way to trigger an RX
      handling event is by filling up the fifo. This causes things like
      getty to not work so well considering it might change the baud
      rate a few times. Fix this by moving the reset on startup and any
      reprogramming required after the reset to be after we change the
      baud rate.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a12f1b40
    • S
      tty: serial: msm: Support sysrq on uartDM devices · 0896d4d4
      Stephen Boyd 提交于
      To properly support sysrq on uartDM hardware we need to properly
      handle break characters. With the DM hardware the fifo can pack 4
      characters at a time, where a break is indicated by an all zero
      byte. Unfortunately, we can't differentiate between an all zero
      byte for a break and an all zero byte of data, so try and do as
      best we can. First unmask the RX break start interrupt and record
      the interrupt when it arrives. Then while processing the fifo,
      detect the break by searching for an all zero character as long
      as we recently received an RX break start interrupt. This should
      make sysrq work fairly well.
      
      Cc: Frank Rowand <frank.rowand@sonymobile.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0896d4d4
    • S
      tty: serial: msm: Fix sysrq spinlock recursion on non-DM · 660beb0e
      Stephen Boyd 提交于
      The handle_rx() path calls uart_handle_sysrq_char() with the port
      lock held. This causes a spinlock recursion. Release and
      reacquire the lock here to avoid this.
      
      BUG: spinlock recursion on CPU#0, swapper/0
       lock: msm_uart_ports+0x1e0/0x2d0, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0
      CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-rc7-00012-gb38ee8265941 #69
      [<c0013964>] (unwind_backtrace) from [<c0011f74>] (show_stack+0x10/0x14)
      [<c0011f74>] (show_stack) from [<c004ed1c>] (do_raw_spin_lock+0x11c/0x13c)
      [<c004ed1c>] (do_raw_spin_lock) from [<c02d44c0>] (msm_console_write+0x78/0x188)
      [<c02d44c0>] (msm_console_write) from [<c0052880>] (call_console_drivers.constprop.22+0xb4/0x144)
      [<c0052880>] (call_console_drivers.constprop.22) from [<c0053570>] (console_unlock+0x27c/0x4ac)
      [<c0053570>] (console_unlock) from [<c0053bb4>] (vprintk_emit+0x1f4/0x5a8)
      [<c0053bb4>] (vprintk_emit) from [<c04ad0ac>] (printk+0x30/0x40)
      [<c04ad0ac>] (printk) from [<c02c2990>] (__handle_sysrq+0x58/0x1b8)
      [<c02c2990>] (__handle_sysrq) from [<c02d41b0>] (msm_irq+0x694/0x6f8)
      [<c02d41b0>] (msm_irq) from [<c0055740>] (handle_irq_event_percpu+0x58/0x270)
      [<c0055740>] (handle_irq_event_percpu) from [<c0055994>] (handle_irq_event+0x3c/0x5c)
      [<c0055994>] (handle_irq_event) from [<c0057e84>] (handle_level_irq+0x9c/0x138)
      [<c0057e84>] (handle_level_irq) from [<c005509c>] (generic_handle_irq+0x24/0x38)
      [<c005509c>] (generic_handle_irq) from [<c000f730>] (handle_IRQ+0x44/0xb0)
      [<c000f730>] (handle_IRQ) from [<c0008518>] (msm_vic_handle_irq+0x44/0x64)
      [<c0008518>] (msm_vic_handle_irq) from [<c04b5ac4>] (__irq_svc+0x44/0x7c)
      Exception stack(0xc0719f68 to 0xc0719fb0)
      9f60:                   00000001 00000001 00000000 c0722938 c0718000 c0769acc
      9f80: 00000000 c0720098 c0769305 4117b362 c0769acc 00000000 01000000 c0719fb0
      9fa0: c004cab0 c000f880 20000013 ffffffff
      [<c04b5ac4>] (__irq_svc) from [<c000f880>] (arch_cpu_idle+0x20/0x30)
      [<c000f880>] (arch_cpu_idle) from [<c004691c>] (cpu_startup_entry+0xf4/0x23c)
      [<c004691c>] (cpu_startup_entry) from [<c06d8b70>] (start_kernel+0x32c/0x394)
      
      Cc: Frank Rowand <frank.rowand@sonymobile.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      660beb0e
  8. 20 10月, 2014 1 次提交
  9. 29 9月, 2014 1 次提交
  10. 09 9月, 2014 6 次提交
  11. 24 7月, 2014 1 次提交
  12. 11 7月, 2014 1 次提交
  13. 10 7月, 2014 1 次提交
  14. 20 6月, 2014 1 次提交
    • P
      serial: Fix IGNBRK handling · ef8b9ddc
      Peter Hurley 提交于
      If IGNBRK is set without either BRKINT or PARMRK set, some uart
      drivers send a 0x00 byte for BREAK without the TTYBREAK flag to the
      line discipline, when it should send either nothing or the TTYBREAK flag
      set. This happens because the read_status_mask masks out the BI
      condition, which uart_insert_char() then interprets as a normal 0x00 byte.
      
      SUS v3 is clear regarding the meaning of IGNBRK; Section 11.2.2, General
      Terminal Interface - Input Modes, states:
        "If IGNBRK is set, a break condition detected on input shall be ignored;
         that is, not put on the input queue and therefore not read by any
         process."
      
      Fix read_status_mask to include the BI bit if IGNBRK is set; the
      lsr status retains the BI bit if a BREAK is recv'd, which is
      subsequently ignored in uart_insert_char() when masked with the
      ignore_status_mask.
      
      Affected drivers:
      8250 - all
      serial_txx9
      mfd
      amba-pl010
      amba-pl011
      atmel_serial
      bfin_uart
      dz
      ip22zilog
      max310x
      mxs-auart
      netx-serial
      pnx8xxx_uart
      pxa
      sb1250-duart
      sccnxp
      serial_ks8695
      sirfsoc_uart
      st-asc
      vr41xx_siu
      zs
      sunzilog
      fsl_lpuart
      sunsab
      ucc_uart
      bcm63xx_uart
      sunsu
      efm32-uart
      pmac_zilog
      mpsc
      msm_serial
      m32r_sio
      
      Unaffected drivers:
      omap-serial
      rp2
      sa1100
      imx
      icom
      
      Annotated for fixes:
      altera_uart
      mcf
      
      Drivers without break detection:
      21285
      xilinx-uartps
      altera_jtaguart
      apbuart
      arc-uart
      clps711x
      max3100
      uartlite
      msm_serial_hs
      nwpserial
      lantiq
      vt8500_serial
      
      Unknown:
      samsung
      mpc52xx_uart
      bfin_sport_uart
      cpm_uart/core
      
      Fixes: Bugzilla #71651, '8250_core.c incorrectly handles IGNBRK flag'
      Reported-by: NIvan <athlon_@mail.ru>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef8b9ddc
  15. 18 6月, 2014 1 次提交
    • K
      tty: serial: msm: Fix section mismatch warning · 4cc29462
      Kumar Gala 提交于
      WARNING: drivers/tty/built-in.o(.data+0x3544): Section mismatch in
      reference from the variable msm_platform_driver to the function
      .init.text:msm_serial_probe()
      The variable msm_platform_driver references
      the function __init msm_serial_probe()
      If the reference is valid then annotate the
      variable with __init* or __refdata (see linux/init.h) or name the variable:
      *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
      Signed-off-by: NKumar Gala <galak@codeaurora.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      4cc29462
  16. 30 5月, 2014 1 次提交
  17. 13 2月, 2014 1 次提交
  18. 28 8月, 2013 4 次提交
    • S
      msm_serial: Send more than 1 character on the console w/ UARTDM · a3957e80
      Stephen Boyd 提交于
      We recently added support to send more than one character at a
      time for UARTDM hardware but we didn't add the same support in
      the console code path. Add support here to speed up console
      messages on UARTDM hardware.
      
      Cc: David Brown <davidb@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3957e80
    • S
      msm_serial: Add support for non-GSBI UARTDM devices · c3b5d3be
      Stephen Boyd 提交于
      Not all UARTDM hardware is part of a GSBI complex. Add support
      for these devices and fix a bug where we assumed uartdm meant the
      hardware was part of a GSBI complex.
      
      Cc: David Brown <davidb@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3b5d3be
    • S
      msm_serial: Switch clock consumer strings and simplify code · bfaddb7d
      Stephen Boyd 提交于
      In downstream kernel we've standardized the clock consumer names
      that MSM device drivers use. Replace the uart specific clock
      names in this driver with the more standard 'core' and 'iface'
      names. Also simplify the code by assuming that clk_prepare_enable
      and clk_disable_unprepare() will properly check for NULL pointers
      (it will because MSM uses the common clock framework).
      
      Cc: David Brown <davidb@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bfaddb7d
    • V
      tty: serial: msm: drop uart_port->lock before calling tty_flip_buffer_push() · f77232da
      Viresh Kumar 提交于
      The current driver triggers a lockdep warning for if tty_flip_buffer_push() is
      called with uart_port->lock locked. This never shows up on UP kernels and comes
      up only on SMP kernels.
      
      Crash looks like this (produced with samsung.c driver):
      
      -----
      [<c0014d58>] (unwind_backtrace+0x0/0xf8) from [<c0011908>] (show_stack+0x10/0x14)
      [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>] (dump_stack+0x6c/0xac)
      [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b59ac>] (do_raw_spin_unlock+0xc4/0xd8)
      [<c01b59ac>] (do_raw_spin_unlock+0xc4/0xd8) from [<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0)
      [<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0x38) from [<c020a1a8>] (s3c24xx_serial_rx_chars+0)
      [<c020a1a8>] (s3c24xx_serial_rx_chars+0x12c/0x260) from [<c020aae8>] (s3c64xx_serial_handle_irq+)
      [<c020aae8>] (s3c64xx_serial_handle_irq+0x48/0x60) from [<c006aaa0>] (handle_irq_event_percpu+0x)
      [<c006aaa0>] (handle_irq_event_percpu+0x50/0x194) from [<c006ac20>] (handle_irq_event+0x3c/0x5c)
      [<c006ac20>] (handle_irq_event+0x3c/0x5c) from [<c006d864>] (handle_fasteoi_irq+0x80/0x13c)
      [<c006d864>] (handle_fasteoi_irq+0x80/0x13c) from [<c006a4a4>] (generic_handle_irq+0x20/0x30)
      [<c006a4a4>] (generic_handle_irq+0x20/0x30) from [<c000f454>] (handle_IRQ+0x38/0x94)
      [<c000f454>] (handle_IRQ+0x38/0x94) from [<c0008538>] (gic_handle_irq+0x34/0x68)
      [<c0008538>] (gic_handle_irq+0x34/0x68) from [<c00123c0>] (__irq_svc+0x40/0x70)
      Exception stack(0xc04cdf70 to 0xc04cdfb8)
      df60:                                     00000000 00000000 0000166e 00000000
      df80: c04cc000 c050278f c050278f 00000001 c04d444c 410fc0f4 c03649b0 00000000
      dfa0: 00000001 c04cdfb8 c000f758 c000f75c 60070013 ffffffff
      [<c00123c0>] (__irq_svc+0x40/0x70) from [<c000f75c>] (arch_cpu_idle+0x28/0x30)
      [<c000f75c>] (arch_cpu_idle+0x28/0x30) from [<c0054888>] (cpu_startup_entry+0x5c/0x148)
      [<c0054888>] (cpu_startup_entry+0x5c/0x148) from [<c0497aa4>] (start_kernel+0x334/0x38c)
      BUG: spinlock lockup suspected on CPU#0, kworker/0:1/360
       lock: s3c24xx_serial_ports+0x1d8/0x370, .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1
      CPU: 0 PID: 360 Comm: kworker/0:1 Not tainted 3.11.0-rc6-next-20130819-00003-g75485f1 #2
      Workqueue: events flush_to_ldisc
      [<c0014d58>] (unwind_backtrace+0x0/0xf8) from [<c0011908>] (show_stack+0x10/0x14)
      [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>] (dump_stack+0x6c/0xac)
      [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b581c>] (do_raw_spin_lock+0x100/0x17c)
      [<c01b581c>] (do_raw_spin_lock+0x100/0x17c) from [<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28)
      [<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28) from [<c0203224>] (uart_start+0x18/0x34)
      [<c0203224>] (uart_start+0x18/0x34) from [<c01ef890>] (__receive_buf+0x4b4/0x738)
      [<c01ef890>] (__receive_buf+0x4b4/0x738) from [<c01efb44>] (n_tty_receive_buf2+0x30/0x98)
      [<c01efb44>] (n_tty_receive_buf2+0x30/0x98) from [<c01f2ba8>] (flush_to_ldisc+0xec/0x138)
      [<c01f2ba8>] (flush_to_ldisc+0xec/0x138) from [<c0031af0>] (process_one_work+0xfc/0x348)
      [<c0031af0>] (process_one_work+0xfc/0x348) from [<c0032138>] (worker_thread+0x138/0x37c)
      [<c0032138>] (worker_thread+0x138/0x37c) from [<c0037a7c>] (kthread+0xa4/0xb0)
      [<c0037a7c>] (kthread+0xa4/0xb0) from [<c000e5f8>] (ret_from_fork+0x14/0x3c)
      -----
      
      Release the port lock before calling tty_flip_buffer_push() and reacquire it
      after the call.
      
      Similar stuff was already done for few other drivers in the past, like:
      
      commit 2389b272
      Author: Thomas Gleixner <tglx@linutronix.de>
      Date:   Tue May 29 21:53:50 2007 +0100
      
          [ARM] 4417/1: Serial: Fix AMBA drivers locking
      
      Cc: David Brown <davidb@codeaurora.org> (maintainer:ARM/QUALCOMM MSM...)
      Cc: Daniel Walker <dwalker@fifo99.com> (maintainer:ARM/QUALCOMM MSM...)
      Cc: Bryan Huntsman <bryanh@codeaurora.org> (maintainer:ARM/QUALCOMM MSM...)
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f77232da
  19. 13 8月, 2013 1 次提交
  20. 27 7月, 2013 2 次提交