.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * CLPS711X SPI bus driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2012-2016 Alexander Shiyan <shc_work@mail.ru> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/io.h> |
---|
13 | 9 | #include <linux/clk.h> |
---|
14 | | -#include <linux/gpio.h> |
---|
| 10 | +#include <linux/gpio/consumer.h> |
---|
15 | 11 | #include <linux/module.h> |
---|
16 | 12 | #include <linux/interrupt.h> |
---|
17 | 13 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
35 | 31 | unsigned int bpw; |
---|
36 | 32 | int len; |
---|
37 | 33 | }; |
---|
38 | | - |
---|
39 | | -static int spi_clps711x_setup(struct spi_device *spi) |
---|
40 | | -{ |
---|
41 | | - if (!spi->controller_state) { |
---|
42 | | - int ret; |
---|
43 | | - |
---|
44 | | - ret = devm_gpio_request(&spi->master->dev, spi->cs_gpio, |
---|
45 | | - dev_name(&spi->master->dev)); |
---|
46 | | - if (ret) |
---|
47 | | - return ret; |
---|
48 | | - |
---|
49 | | - spi->controller_state = spi; |
---|
50 | | - } |
---|
51 | | - |
---|
52 | | - /* We are expect that SPI-device is not selected */ |
---|
53 | | - gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
---|
54 | | - |
---|
55 | | - return 0; |
---|
56 | | -} |
---|
57 | 34 | |
---|
58 | 35 | static int spi_clps711x_prepare_message(struct spi_master *master, |
---|
59 | 36 | struct spi_message *msg) |
---|
.. | .. |
---|
114 | 91 | { |
---|
115 | 92 | struct spi_clps711x_data *hw; |
---|
116 | 93 | struct spi_master *master; |
---|
117 | | - struct resource *res; |
---|
118 | 94 | int irq, ret; |
---|
119 | 95 | |
---|
120 | 96 | irq = platform_get_irq(pdev, 0); |
---|
.. | .. |
---|
125 | 101 | if (!master) |
---|
126 | 102 | return -ENOMEM; |
---|
127 | 103 | |
---|
| 104 | + master->use_gpio_descriptors = true; |
---|
128 | 105 | master->bus_num = -1; |
---|
129 | 106 | master->mode_bits = SPI_CPHA | SPI_CS_HIGH; |
---|
130 | 107 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 8); |
---|
131 | 108 | master->dev.of_node = pdev->dev.of_node; |
---|
132 | | - master->setup = spi_clps711x_setup; |
---|
133 | 109 | master->prepare_message = spi_clps711x_prepare_message; |
---|
134 | 110 | master->transfer_one = spi_clps711x_transfer_one; |
---|
135 | 111 | |
---|
.. | .. |
---|
148 | 124 | goto err_out; |
---|
149 | 125 | } |
---|
150 | 126 | |
---|
151 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
152 | | - hw->syncio = devm_ioremap_resource(&pdev->dev, res); |
---|
| 127 | + hw->syncio = devm_platform_ioremap_resource(pdev, 0); |
---|
153 | 128 | if (IS_ERR(hw->syncio)) { |
---|
154 | 129 | ret = PTR_ERR(hw->syncio); |
---|
155 | 130 | goto err_out; |
---|