[PATCH 1/2] serial: msm-geni: don't rely on parent misc device

Caleb Connolly caleb.connolly at linaro.org
Tue Nov 14 15:56:45 CET 2023



> diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c
> index 78fd9389c036..3e2e15b6cefe 100644
> --- a/drivers/serial/serial_msm_geni.c
> +++ b/drivers/serial/serial_msm_geni.c
[...]
> @@ -499,16 +499,22 @@ static void geni_set_oversampling(struct udevice *dev)
>  	 * It could happen that GENI SE IP is missing in the board's device
>  	 * tree or GENI UART node is a direct child of SoC device tree node.
>  	 */
> -	if (device_get_uclass_id(parent_dev) != UCLASS_MISC)
> -		return;
> +	if (!ofnode_device_is_compatible(parent_node, "qcom,geni-se-qup")) {
> +		pr_err("%s: UART node must be a child of geniqup node\n",
> +		       __func__);
> +		return -ENODEV;
> +	}
>  
> -	ret = misc_read(parent_dev, QUP_HW_VER_REG,
> -			&geni_se_version, sizeof(geni_se_version));
> -	if (ret != sizeof(geni_se_version))
> -		return;
> +	/* Read the HW_VER register relative to the parents address space */
> +	addr = ofnode_get_addr(parent_node);
> +	geni_se_version = readl(addr + QUP_HW_VER_REG);
> +
> +	printf("geni_se_version: %x\n", geni_se_version);

Drop this debugging printf
>  
>  	if (geni_se_version >= QUP_SE_VERSION_2_5)
>  		priv->oversampling /= 2;
> +
> +	return 0;
>  }
>  
>  static inline void geni_serial_init(struct udevice *dev)
> @@ -553,8 +559,11 @@ static inline void geni_serial_init(struct udevice *dev)
>  static int msm_serial_probe(struct udevice *dev)
>  {
>  	struct msm_serial_data *priv = dev_get_priv(dev);
> +	int ret;
>  
> -	geni_set_oversampling(dev);
> +	ret = geni_set_oversampling(dev);
> +	if (ret < 0)
> +		return ret;
>  
>  	/* No need to reinitialize the UART after relocation */
>  	if (gd->flags & GD_FLG_RELOC)
> 

-- 
// Caleb (they/them)


More information about the U-Boot mailing list