RK 方案u-boot阶段添加驱动

2024-08-30 02:36
文章标签 驱动 boot 阶段 方案 rk

本文主要是介绍RK 方案u-boot阶段添加驱动,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

驱动部分:
u-boot/drivers/video/drm/gpio_init.c

/** (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd** SPDX-License-Identifier:	GPL-2.0+*/#include <config.h>
#include <common.h>
#include <errno.h>
#include <malloc.h>
#include <video.h>
#include <backlight.h>
#include <asm/gpio.h>
#include <dm/device.h>
#include <dm/read.h>
#include <dm/uclass.h>
#include <dm/uclass-id.h>
#include <linux/media-bus-format.h>
#include <power/regulator.h>
//DECLARE_GLOBAL_DATA_PTR;
struct customer_gpio_priv {struct udevice *reg;struct gpio_desc wifi_power_gpio;struct gpio_desc usb_switch_gpio;struct gpio_desc usb_switch_gpio2;struct gpio_desc wifi_power_gpio_01;struct gpio_desc power_led_ctrl;uint default_level;uint min_level;uint max_level;
};
static int customer_gpio_ofdata_to_platdata(struct udevice *dev)
{printf("##fan##%s\n",__func__);	return 0;
}static int customer_gpio_probe(struct udevice *dev)
{int ret;
//	struct gpio_desc reset_gpio;struct customer_gpio_priv *priv = dev_get_priv(dev);ret = gpio_request_by_name(dev, "usb-switch2", 0,&priv->usb_switch_gpio2, GPIOD_IS_OUT);if (ret && ret != -ENOENT) {printf("%s: Cannot get usb-switch2: %d\n", __func__, ret);return ret;}printf("####set gpio switch gpio2 low\n");dm_gpio_set_value(&priv->usb_switch_gpio2, 0);ret = gpio_request_by_name(dev, "wifi-gpios", 0,&priv->wifi_power_gpio, GPIOD_IS_OUT);if (ret && ret != -ENOENT) {printf("%s: Cannot get wifi GPIO: %d\n", __func__, ret);return ret;}ret = gpio_request_by_name(dev, "usb-switch", 0,&priv->usb_switch_gpio, GPIOD_IS_OUT);if (ret && ret != -ENOENT) {printf("%s: Cannot get usb-switch11: %d\n", __func__, ret);return ret;}ret = gpio_request_by_name(dev, "power-led-ctl", 0,&priv->power_led_ctrl, GPIOD_IS_OUT);if (ret && ret != -ENOENT) {printf("%s: Cannot get power led ctrl  GPIO: %d\n", __func__, ret);return ret;}dm_gpio_set_value(&priv->usb_switch_gpio, 0);printf("%s:  usb-switch---0h:\n", __func__);mdelay(50);dm_gpio_set_value(&priv->usb_switch_gpio, 1);printf("%s:  usb-switch---1h:\n", __func__);dm_gpio_set_value(&priv->wifi_power_gpio, 1);// dm_gpio_set_value(&priv->wifi_power_gpio_01, 1);mdelay(50);dm_gpio_set_value(&priv->wifi_power_gpio, 0);dm_gpio_set_value(&priv->power_led_ctrl, 1);return 0;
}static const struct udevice_id customer_gpio_ids[] = {//{ .compatible = "mmc-pwrseq-simple"},{ .compatible = "customer-gpio-init", },{}
};U_BOOT_DRIVER(customer_gpio) = {.name = "customer_gpio",.id = UCLASS_CUSTOMER_GPIO,  // 跟下面定义对应.of_match = customer_gpio_ids,.ofdata_to_platdata = customer_gpio_ofdata_to_platdata,.probe = customer_gpio_probe,.priv_auto_alloc_size = sizeof(struct customer_gpio_priv),
//	.platdata_auto_alloc_size = sizeof(struct customer_gpio_priv),
};

u-boot/drivers/video/drm/Makefile 让驱动编译进来

在这里插入图片描述

u-boot/include/dm/uclass-id.h 这个匹配驱动中的.id
在这里插入图片描述

这篇关于RK 方案u-boot阶段添加驱动的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1119560

相关文章

SpringBoot服务获取Pod当前IP的两种方案

《SpringBoot服务获取Pod当前IP的两种方案》在Kubernetes集群中,SpringBoot服务获取Pod当前IP的方案主要有两种,通过环境变量注入或通过Java代码动态获取网络接口IP... 目录方案一:通过 Kubernetes Downward API 注入环境变量原理步骤方案二:通过

Springboot3+将ID转为JSON字符串的详细配置方案

《Springboot3+将ID转为JSON字符串的详细配置方案》:本文主要介绍纯后端实现Long/BigIntegerID转为JSON字符串的详细配置方案,s基于SpringBoot3+和Spr... 目录1. 添加依赖2. 全局 Jackson 配置3. 精准控制(可选)4. OpenAPI (Spri

关于跨域无效的问题及解决(java后端方案)

《关于跨域无效的问题及解决(java后端方案)》:本文主要介绍关于跨域无效的问题及解决(java后端方案),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录通用后端跨域方法1、@CrossOrigin 注解2、springboot2.0 实现WebMvcConfig

在Java中将XLS转换为XLSX的实现方案

《在Java中将XLS转换为XLSX的实现方案》在本文中,我们将探讨传统ExcelXLS格式与现代XLSX格式的结构差异,并为Java开发者提供转换方案,通过了解底层原理、性能优势及实用工具,您将掌握... 目录为什么升级XLS到XLSX值得投入?实际转换过程解析推荐技术方案对比Apache POI实现编程

Spring Boot 整合 Apache Flink 的详细过程

《SpringBoot整合ApacheFlink的详细过程》ApacheFlink是一个高性能的分布式流处理框架,而SpringBoot提供了快速构建企业级应用的能力,下面给大家介绍Spri... 目录Spring Boot 整合 Apache Flink 教程一、背景与目标二、环境准备三、创建项目 & 添

在Spring Boot中实现HTTPS加密通信及常见问题排查

《在SpringBoot中实现HTTPS加密通信及常见问题排查》HTTPS是HTTP的安全版本,通过SSL/TLS协议为通讯提供加密、身份验证和数据完整性保护,下面通过本文给大家介绍在SpringB... 目录一、HTTPS核心原理1.加密流程概述2.加密技术组合二、证书体系详解1、证书类型对比2. 证书获

Java实现本地缓存的常用方案介绍

《Java实现本地缓存的常用方案介绍》本地缓存的代表技术主要有HashMap,GuavaCache,Caffeine和Encahche,这篇文章主要来和大家聊聊java利用这些技术分别实现本地缓存的方... 目录本地缓存实现方式HashMapConcurrentHashMapGuava CacheCaffe

Spring Boot中的YML配置列表及应用小结

《SpringBoot中的YML配置列表及应用小结》在SpringBoot中使用YAML进行列表的配置不仅简洁明了,还能提高代码的可读性和可维护性,:本文主要介绍SpringBoot中的YML配... 目录YAML列表的基础语法在Spring Boot中的应用从YAML读取列表列表中的复杂对象其他注意事项总

Spring Boot 整合 Redis 实现数据缓存案例详解

《SpringBoot整合Redis实现数据缓存案例详解》Springboot缓存,默认使用的是ConcurrentMap的方式来实现的,然而我们在项目中并不会这么使用,本文介绍SpringB... 目录1.添加 Maven 依赖2.配置Redis属性3.创建 redisCacheManager4.使用Sp

redis在spring boot中异常退出的问题解决方案

《redis在springboot中异常退出的问题解决方案》:本文主要介绍redis在springboot中异常退出的问题解决方案,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴... 目录问题:解决 问题根源️ 解决方案1. 异步处理 + 提前ACK(关键步骤)2. 调整Redis消费者组