About NXP SC16IS741A(I2C to UART) with Jetson TX1

Dear Sir,

We would like to use NXP SC16IS741A(I2C to UART) to get the additional UART interface.

L4T:28.2.0
CONFIG_SERIAL_SC16IS7XX=y
CONFIG_SERIAL_SC16IS7XX_I2C=y
Driver Path: /kernel/kernel-4.4/drivers/tty/serial/sc16is7xx.c

This is my final device tree setting

	i2c@7000c000 {
		sc16is741: sc16is741@48 {
		        status = "okay";
                compatible = "nxp,sc16is741";
                reg = <0x48>;
                interrupt-parent = <&gpio>;
                interrupts = <TEGRA_GPIO(K, 4) IRQ_TYPE_EDGE_FALLING>; 
                #interrupt-cells = <2>;
			    interrupt-controller;
                gpio-controller;
                #gpio-cells = <2>;
                vcc-supply = <&battery_reg>;
        };
	};

After booting,

[ 0.503552] <0> [sk]sc16is7xx_i2c_probe irq=0x91: check 0x91
[ 0.503714] sc16is7xx: probe of 0-0048 failed with error -2

=> I got a error at the probe stage.

After debuging,

static int sc16is7xx_probe(struct device *dev,
			   const struct sc16is7xx_devtype *devtype,
			   struct regmap *regmap, int irq, unsigned long flags)
{
	struct sched_param sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
	unsigned long freq, *pfreq = dev_get_platdata(dev);
	int i, ret;
	struct sc16is7xx_port *s;
printk("<0> [sk]sc16is7xx_i2c_probe irq=0x%x: check 0x%x\n", irq, gpio_to_irq(84) );
	if (IS_ERR(regmap))
		return PTR_ERR(regmap);
printk("<0> [sk] regmap ok\n" );
	/* Alloc port structure */
	s = devm_kzalloc(dev, sizeof(*s) +
			 sizeof(struct sc16is7xx_one) * devtype->nr_uart,
			 GFP_KERNEL);
	if (!s) {
		dev_err(dev, "Error allocating port structure\n");
		return -ENOMEM;
	}
static int sc16is7xx_i2c_probe(struct i2c_client *i2c,
			       const struct i2c_device_id *id)
{
	const struct sc16is7xx_devtype *devtype;
	unsigned long flags = 0;
	struct regmap *regmap;

......

	regcfg.max_register = (0xf << SC16IS7XX_REG_SHIFT) |
			      (devtype->nr_uart - 1);
	regmap = devm_regmap_init_i2c(i2c, &regcfg);

	return sc16is7xx_probe(&i2c->dev, devtype, regmap, i2c->irq, flags);
}

=> The error is from

	if (IS_ERR(regmap))
              return PTR_ERR(regmap);

When I use the i2cdetect command, I can see the hardware at 0x48 address of I2C bus 0.

Can you help me this issue for regmap? or Any suggestion?

You may need to trace down the devm_regmap_init_i2c(i2c, &regcfg) to clarify.

Hi ShaneCCC,

Can I ask you some questions?

  1. Does it need to config the device tree for the regmap framework?
  2. Do you know how to check the regmap framework ready?

(PS: Sorry about that. I’m not the expert in the regmap.)
Thanks.
S.K.

As my experience for the driver need configure it not in the device tree like the sensor driver.

static int ov5693_probe(struct i2c_client *client,
                        const struct i2c_device_id *id)
{
         tc_dev->dev = dev;
        strncpy(tc_dev->name, "ov5693", sizeof(tc_dev->name));
        tc_dev->dev_regmap_config = &ov5693_regmap_config;
        tc_dev->sensor_ops = &ov5693_common_ops;