cancel
Showing results for 
Search instead for 
Did you mean: 

USART3 platform_get_irq faild

SAman.1
Associate III

Hy i am using the usart3 from the STM32MP157A-DK1. i orientated myself on the USART driver (https://elixir.bootlin.com/linux/latest/source/drivers/tty/serial/stm32-usart.c).

but

when i want to initialize the

port I get following error code “Rs453Network: probe of 4000f000.serial failed

with error 77�? on this methode stm32port->wakeirq = platform_get_irq(pdev, 1);

I have this device tree configuration:

Stm32mp15xx-dkx.dtsi

&usart3 {

               pinctrl-names = "default", "sleep", "idle";

               pinctrl-0 = <&usart3_pins_b>;

               pinctrl-1 = <&usart3_sleep_pins_b>;

               pinctrl-2 = <&usart3_idle_pins_b>;

               uart-has-rtscts;

               status = "okay";

};

Stm32mp157a-dk1.dts

aliases {

                               ethernet0 = &ethernet0;

                               serial0 = &uart4;

                               //serial1 = &usart3;

                               serial2 = &uart7;

                               usart3 = &usart3;

               };

this is the methode:

static int stm32_init_port(struct stm32_port *stm32port,

 struct platform_device *pdev)

{

struct uart_port *port = &stm32port->port;

struct resource *res;

int ret;

port->iotype = UPIO_MEM;

port->flags = UPF_BOOT_AUTOCONF;

port->ops = &stm32_uart_ops;

port->dev = &pdev->dev;

port->fifosize = stm32port->info->cfg.fifosize;

   

   

ret = platform_get_irq(pdev, 0); //get an IRQ for a device

if (ret <= 0)

return ret ? : -ENODEV;

port->irq = ret;

port->rs485_config = stm32_config_rs485;

   

stm32_init_rs485(port, pdev);

if (stm32port->info->cfg.has_wakeup) {

stm32port->wakeirq = platform_get_irq(pdev, 1);

if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO)

      return stm32port->wakeirq ? : -ENODEV;

}

stm32port->fifoen = stm32port->info->cfg.has_fifo;

  /*get information on the structure of the device resource, 

  like start adress and end adress, in order to find the 

  resource memory size so you can map it in memory.*/

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

port->membase = devm_ioremap_resource(&pdev->dev, res);

if (IS_ERR(port->membase))

    return PTR_ERR(port->membase);

     

port->mapbase = res->start;

spin_lock_init(&port->lock);

stm32port->clk = devm_clk_get(&pdev->dev, NULL);

if (IS_ERR(stm32port->clk))

return PTR_ERR(stm32port->clk);

/* Ensure that clk rate is correct by enabling the clk */

ret = clk_prepare_enable(stm32port->clk);

if (ret)

return ret;

stm32port->port.uartclk = clk_get_rate(stm32port->clk);

if (!stm32port->port.uartclk) {

clk_disable_unprepare(stm32port->clk);

ret = -EINVAL;

}

return ret;

}

1 REPLY 1
PatrickF
ST Employee

Hi,

Did you have a look to https://wiki.st.com/stm32mpu/wiki/Serial_TTY_device_tree_configuration and https://wiki.st.com/stm32mpu/wiki/Serial_TTY_overview ?

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.