| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd |
|---|
| 3 | 4 | * Author: Addy Ke <addy.ke@rock-chips.com> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 7 | +#include <linux/acpi.h> |
|---|
| 16 | 8 | #include <linux/clk.h> |
|---|
| 17 | 9 | #include <linux/delay.h> |
|---|
| 18 | 10 | #include <linux/dmaengine.h> |
|---|
| 19 | | -#include <linux/gpio.h> |
|---|
| 20 | 11 | #include <linux/interrupt.h> |
|---|
| 21 | 12 | #include <linux/miscdevice.h> |
|---|
| 22 | 13 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 197 | 188 | |
|---|
| 198 | 189 | struct clk *spiclk; |
|---|
| 199 | 190 | struct clk *apb_pclk; |
|---|
| 191 | + struct clk *sclk_in; |
|---|
| 200 | 192 | |
|---|
| 201 | 193 | void __iomem *regs; |
|---|
| 202 | 194 | dma_addr_t dma_addr_rx; |
|---|
| .. | .. |
|---|
| 227 | 219 | |
|---|
| 228 | 220 | struct pinctrl_state *high_speed_state; |
|---|
| 229 | 221 | bool slave_aborted; |
|---|
| 230 | | - bool gpio_requested; |
|---|
| 231 | 222 | bool cs_inactive; /* spi slave tansmition stop when cs inactive */ |
|---|
| 223 | + bool cs_high_supported; /* native CS supports active-high polarity */ |
|---|
| 224 | + struct gpio_desc *ready; /* spi slave transmission ready */ |
|---|
| 225 | + |
|---|
| 232 | 226 | struct spi_transfer *xfer; /* Store xfer temporarily */ |
|---|
| 233 | 227 | phys_addr_t base_addr_phy; |
|---|
| 234 | 228 | struct miscdevice miscdev; |
|---|
| .. | .. |
|---|
| 296 | 290 | /* Keep things powered as long as CS is asserted */ |
|---|
| 297 | 291 | pm_runtime_get_sync(rs->dev); |
|---|
| 298 | 292 | |
|---|
| 299 | | - if (gpio_is_valid(spi->cs_gpio)) |
|---|
| 293 | + if (spi->cs_gpiod) |
|---|
| 300 | 294 | ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, 1); |
|---|
| 301 | 295 | else |
|---|
| 302 | 296 | ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select)); |
|---|
| 303 | 297 | } else { |
|---|
| 304 | | - if (gpio_is_valid(spi->cs_gpio)) |
|---|
| 298 | + if (spi->cs_gpiod) |
|---|
| 305 | 299 | ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, 1); |
|---|
| 306 | 300 | else |
|---|
| 307 | 301 | ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select)); |
|---|
| .. | .. |
|---|
| 362 | 356 | static void rockchip_spi_pio_reader(struct rockchip_spi *rs) |
|---|
| 363 | 357 | { |
|---|
| 364 | 358 | u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR); |
|---|
| 365 | | - u32 rx_left = rs->rx_left > words ? rs->rx_left - words : 0; |
|---|
| 359 | + u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0; |
|---|
| 366 | 360 | |
|---|
| 367 | 361 | /* the hardware doesn't allow us to change fifo threshold |
|---|
| 368 | 362 | * level while spi is enabled, so instead make sure to leave |
|---|
| .. | .. |
|---|
| 484 | 478 | { |
|---|
| 485 | 479 | u32 i; |
|---|
| 486 | 480 | |
|---|
| 487 | | - /* burst size: 1, 2, 4, 8 */ |
|---|
| 488 | | - for (i = 1; i < 8; i <<= 1) { |
|---|
| 481 | + /* burst size: 1, 2, 4, 8, 16 */ |
|---|
| 482 | + for (i = 1; i < 16; i <<= 1) { |
|---|
| 489 | 483 | if (data_len & i) |
|---|
| 490 | 484 | break; |
|---|
| 491 | 485 | } |
|---|
| .. | .. |
|---|
| 528 | 522 | .direction = DMA_MEM_TO_DEV, |
|---|
| 529 | 523 | .dst_addr = rs->dma_addr_tx, |
|---|
| 530 | 524 | .dst_addr_width = rs->n_bytes, |
|---|
| 531 | | - .dst_maxburst = 8, |
|---|
| 525 | + .dst_maxburst = rs->fifo_len / 4, |
|---|
| 532 | 526 | }; |
|---|
| 533 | 527 | |
|---|
| 534 | 528 | dmaengine_slave_config(ctlr->dma_tx, &txconf); |
|---|
| .. | .. |
|---|
| 678 | 672 | * ctlr->bits_per_word_mask, so this shouldn't |
|---|
| 679 | 673 | * happen |
|---|
| 680 | 674 | */ |
|---|
| 681 | | - unreachable(); |
|---|
| 675 | + dev_err(rs->dev, "unknown bits per word: %d\n", |
|---|
| 676 | + xfer->bits_per_word); |
|---|
| 677 | + return -EINVAL; |
|---|
| 682 | 678 | } |
|---|
| 683 | 679 | |
|---|
| 684 | 680 | if (xfer_mode == ROCKCHIP_SPI_DMA) { |
|---|
| .. | .. |
|---|
| 864 | 860 | ret = rockchip_spi_prepare_irq(rs, ctlr, xfer); |
|---|
| 865 | 861 | } |
|---|
| 866 | 862 | |
|---|
| 863 | + if (rs->ready) { |
|---|
| 864 | + gpiod_set_value(rs->ready, 0); |
|---|
| 865 | + udelay(1); |
|---|
| 866 | + gpiod_set_value(rs->ready, 1); |
|---|
| 867 | + } |
|---|
| 868 | + |
|---|
| 867 | 869 | if (ret > 0) |
|---|
| 868 | 870 | ret = rockchip_spi_transfer_wait(ctlr, xfer); |
|---|
| 871 | + |
|---|
| 872 | + if (rs->ready) |
|---|
| 873 | + gpiod_set_value(rs->ready, 0); |
|---|
| 869 | 874 | |
|---|
| 870 | 875 | return ret; |
|---|
| 871 | 876 | } |
|---|
| .. | .. |
|---|
| 886 | 891 | |
|---|
| 887 | 892 | static int rockchip_spi_setup(struct spi_device *spi) |
|---|
| 888 | 893 | { |
|---|
| 889 | | - |
|---|
| 890 | | - int ret = -EINVAL; |
|---|
| 891 | 894 | struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller); |
|---|
| 892 | 895 | u32 cr0; |
|---|
| 896 | + |
|---|
| 897 | + if (!spi->cs_gpiod && (spi->mode & SPI_CS_HIGH) && !rs->cs_high_supported) { |
|---|
| 898 | + dev_warn(&spi->dev, "setup: non GPIO CS can't be active-high\n"); |
|---|
| 899 | + return -EINVAL; |
|---|
| 900 | + } |
|---|
| 893 | 901 | |
|---|
| 894 | 902 | pm_runtime_get_sync(rs->dev); |
|---|
| 895 | 903 | |
|---|
| .. | .. |
|---|
| 898 | 906 | cr0 |= ((spi->mode & 0x3) << CR0_SCPH_OFFSET); |
|---|
| 899 | 907 | if (spi->mode & SPI_CS_HIGH) |
|---|
| 900 | 908 | cr0 |= BIT(spi->chip_select) << CR0_SOI_OFFSET; |
|---|
| 909 | + if (spi_controller_is_slave(spi->controller)) |
|---|
| 910 | + cr0 |= CR0_OPM_SLAVE << CR0_OPM_OFFSET; |
|---|
| 901 | 911 | |
|---|
| 902 | 912 | writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); |
|---|
| 903 | 913 | |
|---|
| 904 | 914 | pm_runtime_put(rs->dev); |
|---|
| 905 | 915 | |
|---|
| 906 | | - if (spi->cs_gpio == -ENOENT) |
|---|
| 907 | | - return 0; |
|---|
| 908 | | - |
|---|
| 909 | | - if (!rs->gpio_requested && gpio_is_valid(spi->cs_gpio)) { |
|---|
| 910 | | - ret = gpio_request_one(spi->cs_gpio, |
|---|
| 911 | | - (spi->mode & SPI_CS_HIGH) ? |
|---|
| 912 | | - GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, |
|---|
| 913 | | - dev_name(&spi->dev)); |
|---|
| 914 | | - if (ret) |
|---|
| 915 | | - dev_err(&spi->dev, "can't request chipselect gpio %d\n", |
|---|
| 916 | | - spi->cs_gpio); |
|---|
| 917 | | - else |
|---|
| 918 | | - rs->gpio_requested = true; |
|---|
| 919 | | - } else { |
|---|
| 920 | | - if (gpio_is_valid(spi->cs_gpio)) { |
|---|
| 921 | | - int mode = ((spi->mode & SPI_CS_HIGH) ? 0 : 1); |
|---|
| 922 | | - |
|---|
| 923 | | - ret = gpio_direction_output(spi->cs_gpio, mode); |
|---|
| 924 | | - if (ret) |
|---|
| 925 | | - dev_err(&spi->dev, "chipselect gpio %d setup failed (%d)\n", |
|---|
| 926 | | - spi->cs_gpio, ret); |
|---|
| 927 | | - } |
|---|
| 928 | | - } |
|---|
| 929 | | - |
|---|
| 930 | | - return ret; |
|---|
| 931 | | -} |
|---|
| 932 | | - |
|---|
| 933 | | -static void rockchip_spi_cleanup(struct spi_device *spi) |
|---|
| 934 | | -{ |
|---|
| 935 | | - struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller); |
|---|
| 936 | | - |
|---|
| 937 | | - if (rs->gpio_requested) |
|---|
| 938 | | - gpio_free(spi->cs_gpio); |
|---|
| 916 | + return 0; |
|---|
| 939 | 917 | } |
|---|
| 940 | 918 | |
|---|
| 941 | 919 | static int rockchip_spi_misc_open(struct inode *inode, struct file *filp) |
|---|
| .. | .. |
|---|
| 999 | 977 | struct spi_controller *ctlr; |
|---|
| 1000 | 978 | struct resource *mem; |
|---|
| 1001 | 979 | struct device_node *np = pdev->dev.of_node; |
|---|
| 1002 | | - u32 rsd_nsecs, csm; |
|---|
| 980 | + u32 rsd_nsecs, num_cs, csm; |
|---|
| 1003 | 981 | bool slave_mode; |
|---|
| 1004 | 982 | struct pinctrl *pinctrl = NULL; |
|---|
| 1005 | 983 | const struct rockchip_spi_quirks *quirks_cfg; |
|---|
| 984 | + u32 val; |
|---|
| 1006 | 985 | |
|---|
| 1007 | 986 | slave_mode = of_property_read_bool(np, "spi-slave"); |
|---|
| 1008 | 987 | |
|---|
| .. | .. |
|---|
| 1016 | 995 | if (!ctlr) |
|---|
| 1017 | 996 | return -ENOMEM; |
|---|
| 1018 | 997 | |
|---|
| 998 | + ctlr->rt = device_property_read_bool(&pdev->dev, "rockchip,rt"); |
|---|
| 1019 | 999 | platform_set_drvdata(pdev, ctlr); |
|---|
| 1020 | 1000 | |
|---|
| 1021 | 1001 | rs = spi_controller_get_devdata(ctlr); |
|---|
| .. | .. |
|---|
| 1030 | 1010 | } |
|---|
| 1031 | 1011 | rs->base_addr_phy = mem->start; |
|---|
| 1032 | 1012 | |
|---|
| 1033 | | - rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk"); |
|---|
| 1013 | + if (!has_acpi_companion(&pdev->dev)) |
|---|
| 1014 | + rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk"); |
|---|
| 1034 | 1015 | if (IS_ERR(rs->apb_pclk)) { |
|---|
| 1035 | 1016 | dev_err(&pdev->dev, "Failed to get apb_pclk\n"); |
|---|
| 1036 | 1017 | ret = PTR_ERR(rs->apb_pclk); |
|---|
| 1037 | 1018 | goto err_put_ctlr; |
|---|
| 1038 | 1019 | } |
|---|
| 1039 | 1020 | |
|---|
| 1040 | | - rs->spiclk = devm_clk_get(&pdev->dev, "spiclk"); |
|---|
| 1021 | + if (!has_acpi_companion(&pdev->dev)) |
|---|
| 1022 | + rs->spiclk = devm_clk_get(&pdev->dev, "spiclk"); |
|---|
| 1041 | 1023 | if (IS_ERR(rs->spiclk)) { |
|---|
| 1042 | 1024 | dev_err(&pdev->dev, "Failed to get spi_pclk\n"); |
|---|
| 1043 | 1025 | ret = PTR_ERR(rs->spiclk); |
|---|
| 1026 | + goto err_put_ctlr; |
|---|
| 1027 | + } |
|---|
| 1028 | + |
|---|
| 1029 | + rs->sclk_in = devm_clk_get_optional(&pdev->dev, "sclk_in"); |
|---|
| 1030 | + if (IS_ERR(rs->sclk_in)) { |
|---|
| 1031 | + dev_err(&pdev->dev, "Failed to get sclk_in\n"); |
|---|
| 1032 | + ret = PTR_ERR(rs->sclk_in); |
|---|
| 1044 | 1033 | goto err_put_ctlr; |
|---|
| 1045 | 1034 | } |
|---|
| 1046 | 1035 | |
|---|
| .. | .. |
|---|
| 1056 | 1045 | goto err_disable_apbclk; |
|---|
| 1057 | 1046 | } |
|---|
| 1058 | 1047 | |
|---|
| 1048 | + ret = clk_prepare_enable(rs->sclk_in); |
|---|
| 1049 | + if (ret < 0) { |
|---|
| 1050 | + dev_err(&pdev->dev, "Failed to enable sclk_in\n"); |
|---|
| 1051 | + goto err_disable_spiclk; |
|---|
| 1052 | + } |
|---|
| 1053 | + |
|---|
| 1059 | 1054 | spi_enable_chip(rs, false); |
|---|
| 1060 | 1055 | |
|---|
| 1061 | 1056 | ret = platform_get_irq(pdev, 0); |
|---|
| 1062 | 1057 | if (ret < 0) |
|---|
| 1063 | | - goto err_disable_spiclk; |
|---|
| 1058 | + goto err_disable_sclk_in; |
|---|
| 1064 | 1059 | |
|---|
| 1065 | 1060 | ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL, |
|---|
| 1066 | 1061 | IRQF_ONESHOT, dev_name(&pdev->dev), ctlr); |
|---|
| 1067 | 1062 | if (ret) |
|---|
| 1068 | | - goto err_disable_spiclk; |
|---|
| 1063 | + goto err_disable_sclk_in; |
|---|
| 1069 | 1064 | |
|---|
| 1070 | 1065 | rs->dev = &pdev->dev; |
|---|
| 1071 | | - rs->freq = clk_get_rate(rs->spiclk); |
|---|
| 1072 | | - rs->gpio_requested = false; |
|---|
| 1073 | 1066 | |
|---|
| 1074 | | - if (!of_property_read_u32(pdev->dev.of_node, "rx-sample-delay-ns", |
|---|
| 1075 | | - &rsd_nsecs)) { |
|---|
| 1067 | + rs->freq = clk_get_rate(rs->spiclk); |
|---|
| 1068 | + if (!rs->freq) { |
|---|
| 1069 | + ret = device_property_read_u32(&pdev->dev, "clock-frequency", &rs->freq); |
|---|
| 1070 | + if (ret) { |
|---|
| 1071 | + dev_warn(rs->dev, "Failed to get clock or clock-frequency property\n"); |
|---|
| 1072 | + goto err_disable_sclk_in; |
|---|
| 1073 | + } |
|---|
| 1074 | + } |
|---|
| 1075 | + |
|---|
| 1076 | + if (!device_property_read_u32(&pdev->dev, "rx-sample-delay-ns", &rsd_nsecs)) { |
|---|
| 1076 | 1077 | /* rx sample delay is expressed in parent clock cycles (max 3) */ |
|---|
| 1077 | 1078 | u32 rsd = DIV_ROUND_CLOSEST(rsd_nsecs * (rs->freq >> 8), |
|---|
| 1078 | 1079 | 1000000000 >> 8); |
|---|
| .. | .. |
|---|
| 1102 | 1103 | if (!rs->fifo_len) { |
|---|
| 1103 | 1104 | dev_err(&pdev->dev, "Failed to get fifo length\n"); |
|---|
| 1104 | 1105 | ret = -EINVAL; |
|---|
| 1105 | | - goto err_disable_spiclk; |
|---|
| 1106 | + goto err_disable_sclk_in; |
|---|
| 1106 | 1107 | } |
|---|
| 1107 | 1108 | quirks_cfg = device_get_match_data(&pdev->dev); |
|---|
| 1108 | 1109 | if (quirks_cfg) |
|---|
| 1109 | 1110 | rs->max_baud_div_in_cpha = quirks_cfg->max_baud_div_in_cpha; |
|---|
| 1111 | + |
|---|
| 1112 | + if (!device_property_read_u32(&pdev->dev, "rockchip,autosuspend-delay-ms", &val)) { |
|---|
| 1113 | + if (val > 0) { |
|---|
| 1114 | + pm_runtime_set_autosuspend_delay(&pdev->dev, val); |
|---|
| 1115 | + pm_runtime_use_autosuspend(&pdev->dev); |
|---|
| 1116 | + } |
|---|
| 1117 | + } |
|---|
| 1110 | 1118 | |
|---|
| 1111 | 1119 | pm_runtime_set_active(&pdev->dev); |
|---|
| 1112 | 1120 | pm_runtime_enable(&pdev->dev); |
|---|
| 1113 | 1121 | |
|---|
| 1114 | 1122 | ctlr->auto_runtime_pm = true; |
|---|
| 1115 | 1123 | ctlr->bus_num = pdev->id; |
|---|
| 1116 | | - ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST | SPI_CS_HIGH; |
|---|
| 1124 | + ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST; |
|---|
| 1117 | 1125 | if (slave_mode) { |
|---|
| 1118 | 1126 | ctlr->mode_bits |= SPI_NO_CS; |
|---|
| 1119 | 1127 | ctlr->slave_abort = rockchip_spi_slave_abort; |
|---|
| 1120 | 1128 | } else { |
|---|
| 1121 | 1129 | ctlr->flags = SPI_MASTER_GPIO_SS; |
|---|
| 1130 | + ctlr->max_native_cs = ROCKCHIP_SPI_MAX_CS_NUM; |
|---|
| 1131 | + /* |
|---|
| 1132 | + * rk spi0 has two native cs, spi1..5 one cs only |
|---|
| 1133 | + * if num-cs is missing in the dts, default to 1 |
|---|
| 1134 | + */ |
|---|
| 1135 | + if (device_property_read_u32(&pdev->dev, "num-cs", &num_cs)) |
|---|
| 1136 | + num_cs = 1; |
|---|
| 1137 | + ctlr->num_chipselect = num_cs; |
|---|
| 1138 | + ctlr->use_gpio_descriptors = true; |
|---|
| 1122 | 1139 | } |
|---|
| 1123 | | - ctlr->num_chipselect = ROCKCHIP_SPI_MAX_CS_NUM; |
|---|
| 1124 | 1140 | ctlr->dev.of_node = pdev->dev.of_node; |
|---|
| 1125 | 1141 | ctlr->bits_per_word_mask = SPI_BPW_MASK(16) | SPI_BPW_MASK(8) | SPI_BPW_MASK(4); |
|---|
| 1126 | 1142 | ctlr->min_speed_hz = rs->freq / BAUDR_SCKDV_MAX; |
|---|
| 1127 | 1143 | ctlr->max_speed_hz = min(rs->freq / BAUDR_SCKDV_MIN, MAX_SCLK_OUT); |
|---|
| 1128 | 1144 | |
|---|
| 1129 | | - ctlr->set_cs = rockchip_spi_set_cs; |
|---|
| 1130 | 1145 | ctlr->setup = rockchip_spi_setup; |
|---|
| 1131 | | - ctlr->cleanup = rockchip_spi_cleanup; |
|---|
| 1146 | + ctlr->set_cs = rockchip_spi_set_cs; |
|---|
| 1132 | 1147 | ctlr->transfer_one = rockchip_spi_transfer_one; |
|---|
| 1133 | 1148 | ctlr->max_transfer_size = rockchip_spi_max_transfer_size; |
|---|
| 1134 | 1149 | ctlr->handle_err = rockchip_spi_handle_err; |
|---|
| .. | .. |
|---|
| 1169 | 1184 | } |
|---|
| 1170 | 1185 | |
|---|
| 1171 | 1186 | switch (rs->version) { |
|---|
| 1172 | | - case ROCKCHIP_SPI_VER2_TYPE1: |
|---|
| 1173 | 1187 | case ROCKCHIP_SPI_VER2_TYPE2: |
|---|
| 1188 | + rs->cs_high_supported = true; |
|---|
| 1189 | + ctlr->mode_bits |= SPI_CS_HIGH; |
|---|
| 1174 | 1190 | if (slave_mode) |
|---|
| 1175 | 1191 | rs->cs_inactive = true; |
|---|
| 1176 | 1192 | else |
|---|
| .. | .. |
|---|
| 1178 | 1194 | break; |
|---|
| 1179 | 1195 | default: |
|---|
| 1180 | 1196 | rs->cs_inactive = false; |
|---|
| 1197 | + break; |
|---|
| 1181 | 1198 | } |
|---|
| 1199 | + if (device_property_read_bool(&pdev->dev, "rockchip,cs-inactive-disable")) |
|---|
| 1200 | + rs->cs_inactive = false; |
|---|
| 1201 | + |
|---|
| 1182 | 1202 | pinctrl = devm_pinctrl_get(&pdev->dev); |
|---|
| 1183 | 1203 | if (!IS_ERR(pinctrl)) { |
|---|
| 1184 | 1204 | rs->high_speed_state = pinctrl_lookup_state(pinctrl, "high_speed"); |
|---|
| .. | .. |
|---|
| 1186 | 1206 | dev_warn(&pdev->dev, "no high_speed pinctrl state\n"); |
|---|
| 1187 | 1207 | rs->high_speed_state = NULL; |
|---|
| 1188 | 1208 | } |
|---|
| 1209 | + } |
|---|
| 1210 | + |
|---|
| 1211 | + rs->ready = devm_gpiod_get_optional(&pdev->dev, "ready", GPIOD_OUT_HIGH); |
|---|
| 1212 | + if (IS_ERR(rs->ready)) { |
|---|
| 1213 | + ret = dev_err_probe(&pdev->dev, PTR_ERR(rs->ready), |
|---|
| 1214 | + "invalid ready-gpios property in node\n"); |
|---|
| 1215 | + goto err_free_dma_rx; |
|---|
| 1189 | 1216 | } |
|---|
| 1190 | 1217 | |
|---|
| 1191 | 1218 | ret = devm_spi_register_controller(&pdev->dev, ctlr); |
|---|
| .. | .. |
|---|
| 1210 | 1237 | dev_info(&pdev->dev, "register misc device %s\n", misc_name); |
|---|
| 1211 | 1238 | } |
|---|
| 1212 | 1239 | |
|---|
| 1213 | | - dev_info(rs->dev, "probed, poll=%d, rsd=%d\n", rs->poll, rs->rsd); |
|---|
| 1240 | + dev_info(rs->dev, "probed, poll=%d, rsd=%d, cs-inactive=%d, ready=%d\n", |
|---|
| 1241 | + rs->poll, rs->rsd, rs->cs_inactive, rs->ready ? 1 : 0); |
|---|
| 1214 | 1242 | |
|---|
| 1215 | 1243 | return 0; |
|---|
| 1216 | 1244 | |
|---|
| .. | .. |
|---|
| 1222 | 1250 | dma_release_channel(ctlr->dma_tx); |
|---|
| 1223 | 1251 | err_disable_pm_runtime: |
|---|
| 1224 | 1252 | pm_runtime_disable(&pdev->dev); |
|---|
| 1253 | +err_disable_sclk_in: |
|---|
| 1254 | + clk_disable_unprepare(rs->sclk_in); |
|---|
| 1225 | 1255 | err_disable_spiclk: |
|---|
| 1226 | 1256 | clk_disable_unprepare(rs->spiclk); |
|---|
| 1227 | 1257 | err_disable_apbclk: |
|---|
| .. | .. |
|---|
| 1242 | 1272 | |
|---|
| 1243 | 1273 | pm_runtime_get_sync(&pdev->dev); |
|---|
| 1244 | 1274 | |
|---|
| 1275 | + clk_disable_unprepare(rs->sclk_in); |
|---|
| 1245 | 1276 | clk_disable_unprepare(rs->spiclk); |
|---|
| 1246 | 1277 | clk_disable_unprepare(rs->apb_pclk); |
|---|
| 1247 | 1278 | |
|---|
| .. | .. |
|---|
| 1344 | 1375 | .compatible = "rockchip,px30-spi", |
|---|
| 1345 | 1376 | .data = &rockchip_spi_quirks_cfg, |
|---|
| 1346 | 1377 | }, |
|---|
| 1347 | | - { .compatible = "rockchip,rv1108-spi", }, |
|---|
| 1348 | | - { .compatible = "rockchip,rv1126-spi", }, |
|---|
| 1349 | 1378 | { .compatible = "rockchip,rk3036-spi", }, |
|---|
| 1350 | 1379 | { .compatible = "rockchip,rk3066-spi", }, |
|---|
| 1351 | 1380 | { .compatible = "rockchip,rk3188-spi", }, |
|---|
| 1352 | 1381 | { .compatible = "rockchip,rk3228-spi", }, |
|---|
| 1353 | 1382 | { .compatible = "rockchip,rk3288-spi", }, |
|---|
| 1383 | + { .compatible = "rockchip,rk3308-spi", }, |
|---|
| 1384 | + { .compatible = "rockchip,rk3328-spi", }, |
|---|
| 1354 | 1385 | { .compatible = "rockchip,rk3368-spi", }, |
|---|
| 1355 | 1386 | { .compatible = "rockchip,rk3399-spi", }, |
|---|
| 1387 | + { .compatible = "rockchip,rv1106-spi", }, |
|---|
| 1388 | + { .compatible = "rockchip,rv1108-spi", }, |
|---|
| 1389 | + { .compatible = "rockchip,rv1126-spi", }, |
|---|
| 1356 | 1390 | { }, |
|---|
| 1357 | 1391 | }; |
|---|
| 1358 | 1392 | MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match); |
|---|