rk3588s的DTS配置中,存在sdhci,sdmmc,sdio这些接口的作用分别是什么?一般如何配置?
时间: 2024-04-28 16:19:52 浏览: 373
在 rk3588s 的 DTS 配置中,sdhci、sdmmc 和 sdio 都是用于控制存储设备的接口。
其中,sdhci 是用于控制 SD 卡和 eMMC 存储设备的接口;sdmmc 则是用于控制 SDIO 设备的接口;而 sdio 则是用于控制 WLAN 或蓝牙等无线模块的接口。
对于这些接口的配置,一般需要设置相应的时钟频率、电压等参数,并配置对应的中断和 DMA 控制器等。具体的配置方法可以参考 RK3588s 的官方文档,或者查看相关的 DTS 文件进行配置。
相关问题
rk3588s 平台配置 AP6275 芯片,请提供配置DTS文件,采用UART9
以下是一个可能的DTS配置文件,用于在rk3588s平台上配置AP6275芯片,采用UART9接口:
```
/dts-v1/;
/plugin/;
/ {
model = "rk3588s-ap6275";
compatible = "rockchip,rk3588s", "rockchip,rk3588";
chosen {
bootargs = "console=ttyS9,115200n8 root=/dev/mmcblk0p1 rw rootwait earlycon";
};
memory@60000000 {
device_type = "memory";
reg = <0x0 0x60000000 0x0 0x80000000>;
};
chosen {
bootargs = "console=ttyS9,115200n8 root=/dev/mmcblk0p1 rw rootwait earlycon";
};
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
ap6275_reserved: ap6275_reserved@0 {
reg = <0x0 0xff000000 0x0 0x400000>;
no-map;
linux,phandle = <&ap6275_reserved>;
phandle = <&ap6275_reserved>;
};
};
aliases {
serial9 = "/soc/serial@f7300000";
};
soc {
#address-cells = <2>;
#size-cells = <2>;
compatible = "simple-bus";
ranges;
serial@f7300000 {
compatible = "snps,dw-apb-uart";
reg = <0xf7300000 0x1000>;
interrupts = <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru UART9_CLK>;
clock-names = "uart_clk";
status = "okay";
};
};
&serial9 {
status = "okay";
};
&mmc {
status = "okay";
vmmc-supply = <&vcc_3v3>;
pinctrl-0 = <&emmc_clk_4bit>;
pinctrl-names = "default";
bus-width = <4>;
max-frequency = <200000000>;
non-removable;
assigned-clocks = <&cru EMMC_CLK>;
assigned-clock-rates = <200000000>;
status = "okay";
};
&mmc_phy {
status = "okay";
};
&sdhci {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&sdcard_clk>;
bus-width = <8>;
max-frequency = <200000000>;
non-removable;
vmmc-supply = <&vcc_3v3>;
};
&sdcard_clk {
rockchip,pins = <10 14 RK_FUNC_2 &pcfg_pull_none>;
};
&i2c2 {
status = "okay";
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&i2c2_mclk>;
};
&i2c2_mclk {
rockchip,pins = <11 12 RK_FUNC_1 &pcfg_pull_none>;
};
};
```
请注意,这只是一个参考配置文件,具体的配置可能会因为具体的硬件配置而有所不同。另外,这个配置文件并没有包含AP6275的具体配置信息,你需要在你的设备上根据实际情况进行配置。
rk3308 sdio 配置驱动sd 卡 设备树配置和驱动配置
RK3308 SoC 支持SDIO接口,可以通过SDIO接口连接SD卡。下面是SDIO SD卡设备树配置和驱动配置的步骤:
1. 设备树配置
在设备树中添加SDIO节点,配置SDIO相关的属性。例如:
```
sdmmc: sdmmc@ff140000 {
compatible = "rockchip,rk3308-sdmmc";
reg = <0x0 0xff140000 0x0 0x10000>;
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru SCLK_SDMMC>;
clock-names = "clk_sdmmc";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4 &sdmmc_bus8>;
pinctrl-1 = <&sdmmc_clk_sleep &sdmmc_cmd_sleep &sdmmc_bus4_sleep &sdmmc_bus8_sleep>;
bus-width = <4>;
status = "okay";
};
```
其中,`compatible`属性是设备树中的兼容性属性,`reg`属性是SDIO控制器的寄存器地址和大小,`interrupts`属性是中断号,`clocks`属性是时钟节点,`pinctrl-names`和`pinctrl-0`属性是管脚配置,`bus-width`属性是总线宽度,`status`属性是设备状态,这里设置为"okay"表示设备可用。
2. 驱动配置
在内核中添加SDIO驱动,并配置SDIO控制器和SD卡之间的通信。例如:
```
static struct sdhci_pltfm_data rk3308_sdhci_pdata = {
.ops = &rk3308_sdhci_ops,
.clk = RK3308_SDMMC_CLK,
.cd_gpio = -1,
.cd_inverted = true,
};
static const struct sdhci_ops rk3308_sdhci_ops = {
.set_clock = rk3308_sdhci_set_clock,
.set_bus_width = rk3308_sdhci_set_bus_width,
.set_uhs_signaling = rk3308_sdhci_set_uhs_signaling,
.send_command = rk3308_sdhci_send_command,
.reset = rk3308_sdhci_reset,
.get_ro = rk3308_sdhci_get_ro,
};
static const struct of_device_id rk3308_sdhci_of_match[] = {
{ .compatible = "rockchip,rk3308-sdmmc" },
{}
};
MODULE_DEVICE_TABLE(of, rk3308_sdhci_of_match);
static struct platform_driver rk3308_sdhci_driver = {
.driver = {
.name = "rk3308-sdhci",
.of_match_table = rk3308_sdhci_of_match,
},
.probe = rk3308_sdhci_probe,
.remove = rk3308_sdhci_remove,
};
static int __init rk3308_sdhci_init(void)
{
return platform_driver_register(&rk3308_sdhci_driver);
}
static void __exit rk3308_sdhci_exit(void)
{
platform_driver_unregister(&rk3308_sdhci_driver);
}
module_init(rk3308_sdhci_init);
module_exit(rk3308_sdhci_exit);
```
其中,`sdhci_pltfm_data`结构体是SDHCI平台数据,`sdhci_ops`结构体是SDHCI操作函数,`of_device_id`结构体是设备树匹配信息,`platform_driver`结构体是平台驱动,`rk3308_sdhci_init`和`rk3308_sdhci_exit`是驱动初始化和卸载函数。具体实现可以参考内核源码中的SDHCI驱动实现。
以上是SDIO SD卡设备树配置和驱动配置的基本步骤,需要根据具体的系统和硬件进行适当调整和修改。
阅读全文