AnsweredAssumed Answered

I2C to UART IS16SC762 "BUG: Scheduling while atomic" error on i.MX6SL

Question asked by Jacob Postman on May 19, 2015
Latest reply on Jun 5, 2015 by Fabio Estevam

Hello,

 

I am attempting to bring up a SC16IS762 (I2C to dual UART/RS232/RS485 interface) on an i.MX6SL based custom board and am looking for some guidance.

 

Two tty devices appear as expected (/dev/ttySC0 and ttySC1).

However, when I attempt to interact with either device via console I receive the message "BUG: scheduling while atomic" and stack dump(s) as shown below.

 

As seen in the stack dump below, a call to schedule() in i2c_imx_bus_busy() (drivers/i2c/busses/i2c-imx.c) seems to trigger the error, but I have not yet been able to determine how the interaction between sc16is7xx and i2c-imx drivers are misbehaving.

 

What I have done:

 

1. Pulled in a driver for the sc16is7xx, added the device to drivers/tty/serial/Kconfig and drivers/tty/serial/Makefile

Driver pulled from 3.16: http://lxr.free-electrons.com/source/drivers/tty/serial/sc16is7xx.c?v=3.16

 

2. Observe the same behavior on both imx_3.10.17_1.0.1_ga and imx_3.14.28_1.0.0_ga kernels.

 

3. SC16IS762 is connected to I2C3 and uses GPIO2_12 as an active low interrupt request.

 

4. I've added the following pad and device configuration to the board device tree:

i2c3 {
  pinctrl_i2c3_1: i2c3grp-1 {
  fsl,pins = <
  MX6SL_PAD_EPDC_SDCE2__I2C3_SCL 0x4001b8b1
  MX6SL_PAD_EPDC_SDCE3__I2C3_SDA 0x4001b8b1
  MX6SL_PAD_EPDC_PWRINT__GPIO2_IO12 0x1F059
  >;
  };
  };


&i2c3 {
  clock-frequency = <400000>;
  pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_i2c3_1>;
  status = "okay";


  sc16is762: sc16is762@48 {
    compatible = "nxp,sc16is762";
                reg = <0x48>;
  clocks = <&clks IMX6SL_CLK_I2C3>;
                interrupt-parent = <&gpio2>;
                interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
                gpio-controller;
                #gpio-cells = <2>;
        };
};

 

5. When interacting with ttySC0/1 via console, I receive the following BUG message and stack dump

# echo "text" > /dev/ttySC1
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Not tainted 3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<8042ad14>] (i2c_imx_bus_busy+0x3c/0x88)
[<8042ad14>] (i2c_imx_bus_busy) from [<8042b024>] (i2c_imx_xfer+0x234/0x6d4)
[<8042b024>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4)
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x5c)
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Tainted: G        W    3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<8042ad14>] (i2c_imx_bus_busy+0x3c/0x88)
[<8042ad14>] (i2c_imx_bus_busy) from [<8042b024>] (i2c_imx_xfer+0x234/0x6d4)
[<8042b024>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4)
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x5c)
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Tainted: G        W    3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<806bdd50>] (schedule_timeout+0x110/0x188)
[<806bdd50>] (schedule_timeout) from [<8042ade8>] (i2c_imx_trx_complete+0x88/0x90)
[<8042ade8>] (i2c_imx_trx_complete) from [<8042b324>] (i2c_imx_xfer+0x534/0x6d4)
[<8042b324>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4)
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x5c)
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Tainted: G        W    3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<806bdd50>] (schedule_timeout+0x110/0x188)
[<806bdd50>] (schedule_timeout) from [<8042ade8>] (i2c_imx_trx_complete+0x88/0x90)
[<8042ade8>] (i2c_imx_trx_complete) from [<8042b398>] (i2c_imx_xfer+0x5a8/0x6d4)
[<8042b398>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4)
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x5c)
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Tainted: G        W    3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<806bdd50>] (schedule_timeout+0x110/0x188)
[<806bdd50>] (schedule_timeout) from [<8042ade8>] (i2c_imx_trx_complete+0x88/0x90)
[<8042ade8>] (i2c_imx_trx_complete) from [<8042b398>] (i2c_imx_xfer+0x5a8/0x6d4)
[<8042b398>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4)
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x5c)
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)
BUG: scheduling while atomic: sh/457/0x00000002
Modules linked in:
CPU: 0 PID: 457 Comm: sh Tainted: G        W    3.14.28-04038-g1d8abdf-dirty #5
[<80014818>] (unwind_backtrace) from [<80011524>] (show_stack+0x10/0x14)
[<80011524>] (show_stack) from [<806bbb94>] (dump_stack+0x64/0xb4)
[<806bbb94>] (dump_stack) from [<806b9ab8>] (__schedule_bug+0x44/0x5c)
[<806b9ab8>] (__schedule_bug) from [<806be6cc>] (__schedule+0x48c/0x530)
[<806be6cc>] (__schedule) from [<8042ad14>] (i2c_imx_bus_busy+0x3c/0x88)
[<8042ad14>] (i2c_imx_bus_busy) from [<8042b4a0>] (i2c_imx_xfer+0x6b0/0x6d4)
[<8042b4a0>] (i2c_imx_xfer) from [<80426b98>] (__i2c_transfer+0x44/0x7c)
[<80426b98>] (__i2c_transfer) from [<80427f38>] (i2c_transfer+0x7c/0xb8)
[<80427f38>] (i2c_transfer) from [<80428000>] (i2c_master_send+0x3c/0x4c)
[<80428000>] (i2c_master_send) from [<80340d98>] (regmap_i2c_write+0x10/0x2c)
[<80340d98>] (regmap_i2c_write) from [<8033dcc8>] (_regmap_raw_write+0x5b8/0x5e4
[<8033dcc8>] (_regmap_raw_write) from [<8033cdd0>] (_regmap_write+0x58/0x94)
[<8033cdd0>] (_regmap_write) from [<8033cfa8>] (_regmap_update_bits+0x54/0x64)
[<8033cfa8>] (_regmap_update_bits) from [<8033d12c>] (regmap_update_bits+0x40/0x
[<8033d12c>] (regmap_update_bits) from [<80304704>] (uart_close+0x174/0x190)
[<80304704>] (uart_close) from [<802eaf4c>] (tty_release+0xf4/0x4b4)
[<802eaf4c>] (tty_release) from [<800d07e0>] (__fput+0x80/0x1e8)
[<800d07e0>] (__fput) from [<80043090>] (task_work_run+0xa4/0xd8)
[<80043090>] (task_work_run) from [<80011164>] (do_work_pending+0xa0/0xac)
[<80011164>] (do_work_pending) from [<8000e3e0>] (work_pending+0xc/0x20)

 

Any thoughts or suggestions are appreciated.

Outcomes