Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2006 Ben Warren, Qstreams Networks Inc. |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 4 | * With help from the common/soft_spi and arch/powerpc/cpu/mpc8260 drivers |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 8 | #include <clk.h> |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 9 | #include <dm.h> |
| 10 | #include <errno.h> |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 11 | #include <malloc.h> |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 12 | #include <spi.h> |
| 13 | #include <asm/mpc8xxx_spi.h> |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 14 | #include <asm-generic/gpio.h> |
Rasmus Villemoes | d4e78c3 | 2020-04-20 16:13:41 +0200 | [diff] [blame] | 15 | #include <dm/device_compat.h> |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 16 | |
Mario Six | 10f300a | 2019-04-29 01:58:41 +0530 | [diff] [blame] | 17 | enum { |
| 18 | SPI_EV_NE = BIT(31 - 22), /* Receiver Not Empty */ |
| 19 | SPI_EV_NF = BIT(31 - 23), /* Transmitter Not Full */ |
| 20 | }; |
| 21 | |
| 22 | enum { |
| 23 | SPI_MODE_LOOP = BIT(31 - 1), /* Loopback mode */ |
| 24 | SPI_MODE_CI = BIT(31 - 2), /* Clock invert */ |
| 25 | SPI_MODE_CP = BIT(31 - 3), /* Clock phase */ |
| 26 | SPI_MODE_DIV16 = BIT(31 - 4), /* Divide clock source by 16 */ |
| 27 | SPI_MODE_REV = BIT(31 - 5), /* Reverse mode - MSB first */ |
| 28 | SPI_MODE_MS = BIT(31 - 6), /* Always master */ |
| 29 | SPI_MODE_EN = BIT(31 - 7), /* Enable interface */ |
| 30 | |
| 31 | SPI_MODE_LEN_MASK = 0xf00000, |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 32 | SPI_MODE_LEN_SHIFT = 20, |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 33 | SPI_MODE_PM_SHIFT = 16, |
Mario Six | 10f300a | 2019-04-29 01:58:41 +0530 | [diff] [blame] | 34 | SPI_MODE_PM_MASK = 0xf0000, |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 35 | |
Mario Six | 10f300a | 2019-04-29 01:58:41 +0530 | [diff] [blame] | 36 | SPI_COM_LST = BIT(31 - 9), |
| 37 | }; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 38 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 39 | struct mpc8xxx_priv { |
| 40 | spi8xxx_t *spi; |
| 41 | struct gpio_desc gpios[16]; |
Rasmus Villemoes | d31ec8b | 2020-02-11 15:20:24 +0000 | [diff] [blame] | 42 | int cs_count; |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 43 | ulong clk_rate; |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 44 | }; |
| 45 | |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 46 | #define SPI_TIMEOUT 1000 |
| 47 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 48 | static int mpc8xxx_spi_ofdata_to_platdata(struct udevice *dev) |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 49 | { |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 50 | struct mpc8xxx_priv *priv = dev_get_priv(dev); |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 51 | struct clk clk; |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 52 | int ret; |
| 53 | |
| 54 | priv->spi = (spi8xxx_t *)dev_read_addr(dev); |
| 55 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 56 | ret = gpio_request_list_by_name(dev, "gpios", priv->gpios, |
| 57 | ARRAY_SIZE(priv->gpios), GPIOD_IS_OUT | GPIOD_ACTIVE_LOW); |
| 58 | if (ret < 0) |
| 59 | return -EINVAL; |
| 60 | |
Rasmus Villemoes | d31ec8b | 2020-02-11 15:20:24 +0000 | [diff] [blame] | 61 | priv->cs_count = ret; |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 62 | |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 63 | ret = clk_get_by_index(dev, 0, &clk); |
| 64 | if (ret) { |
| 65 | dev_err(dev, "%s: clock not defined\n", __func__); |
| 66 | return ret; |
| 67 | } |
| 68 | |
| 69 | priv->clk_rate = clk_get_rate(&clk); |
| 70 | if (!priv->clk_rate) { |
| 71 | dev_err(dev, "%s: failed to get clock rate\n", __func__); |
| 72 | return -EINVAL; |
| 73 | } |
| 74 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 75 | return 0; |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 76 | } |
| 77 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 78 | static int mpc8xxx_spi_probe(struct udevice *dev) |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 79 | { |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 80 | struct mpc8xxx_priv *priv = dev_get_priv(dev); |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 81 | spi8xxx_t *spi = priv->spi; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 82 | |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 83 | /* |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 84 | * SPI pins on the MPC83xx are not muxed, so all we do is initialize |
| 85 | * some registers |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 86 | */ |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 87 | out_be32(&priv->spi->mode, SPI_MODE_REV | SPI_MODE_MS); |
| 88 | |
| 89 | /* set len to 8 bits */ |
| 90 | setbits_be32(&spi->mode, (8 - 1) << SPI_MODE_LEN_SHIFT); |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 91 | |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 92 | setbits_be32(&spi->mode, SPI_MODE_EN); |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 93 | |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 94 | /* Clear all SPI events */ |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 95 | setbits_be32(&priv->spi->event, 0xffffffff); |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 96 | /* Mask all SPI interrupts */ |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 97 | clrbits_be32(&priv->spi->mask, 0xffffffff); |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 98 | /* LST bit doesn't do anything, so disregard */ |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 99 | out_be32(&priv->spi->com, 0); |
| 100 | |
| 101 | return 0; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 102 | } |
| 103 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 104 | static void mpc8xxx_spi_cs_activate(struct udevice *dev) |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 105 | { |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 106 | struct mpc8xxx_priv *priv = dev_get_priv(dev->parent); |
| 107 | struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); |
| 108 | |
| 109 | dm_gpio_set_dir_flags(&priv->gpios[platdata->cs], GPIOD_IS_OUT); |
| 110 | dm_gpio_set_value(&priv->gpios[platdata->cs], 0); |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 111 | } |
| 112 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 113 | static void mpc8xxx_spi_cs_deactivate(struct udevice *dev) |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 114 | { |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 115 | struct mpc8xxx_priv *priv = dev_get_priv(dev->parent); |
| 116 | struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); |
| 117 | |
| 118 | dm_gpio_set_dir_flags(&priv->gpios[platdata->cs], GPIOD_IS_OUT); |
| 119 | dm_gpio_set_value(&priv->gpios[platdata->cs], 1); |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 120 | } |
| 121 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 122 | static int mpc8xxx_spi_xfer(struct udevice *dev, uint bitlen, |
| 123 | const void *dout, void *din, ulong flags) |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 124 | { |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 125 | struct udevice *bus = dev->parent; |
| 126 | struct mpc8xxx_priv *priv = dev_get_priv(bus); |
| 127 | spi8xxx_t *spi = priv->spi; |
| 128 | struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 129 | u32 tmpdin = 0, tmpdout = 0, n; |
| 130 | const u8 *cout = dout; |
| 131 | u8 *cin = din; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 132 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 133 | debug("%s: slave %s:%u dout %08X din %08X bitlen %u\n", __func__, |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 134 | bus->name, platdata->cs, (uint)dout, (uint)din, bitlen); |
Rasmus Villemoes | d31ec8b | 2020-02-11 15:20:24 +0000 | [diff] [blame] | 135 | if (platdata->cs >= priv->cs_count) { |
| 136 | dev_err(dev, "chip select index %d too large (cs_count=%d)\n", |
| 137 | platdata->cs, priv->cs_count); |
| 138 | return -EINVAL; |
| 139 | } |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 140 | if (bitlen % 8) { |
| 141 | printf("*** spi_xfer: bitlen must be multiple of 8\n"); |
| 142 | return -ENOTSUPP; |
| 143 | } |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 144 | |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 145 | if (flags & SPI_XFER_BEGIN) |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 146 | mpc8xxx_spi_cs_activate(dev); |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 147 | |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 148 | /* Clear all SPI events */ |
Mario Six | dee9949 | 2019-04-29 01:58:42 +0530 | [diff] [blame] | 149 | setbits_be32(&spi->event, 0xffffffff); |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 150 | n = bitlen / 8; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 151 | |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 152 | /* Handle data in 8-bit chunks */ |
| 153 | while (n--) { |
Mario Six | 9083b13 | 2019-04-29 01:58:52 +0530 | [diff] [blame] | 154 | ulong start; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 155 | |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 156 | if (cout) |
| 157 | tmpdout = *cout++; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 158 | |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 159 | /* Write the data out */ |
Mario Six | dee9949 | 2019-04-29 01:58:42 +0530 | [diff] [blame] | 160 | out_be32(&spi->tx, tmpdout); |
Mario Six | 4d3082b | 2019-04-29 01:58:37 +0530 | [diff] [blame] | 161 | |
Mario Six | f9d5ca2 | 2019-04-29 01:58:40 +0530 | [diff] [blame] | 162 | debug("*** %s: ... %08x written\n", __func__, tmpdout); |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 163 | |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 164 | /* |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 165 | * Wait for SPI transmit to get out |
| 166 | * or time out (1 second = 1000 ms) |
| 167 | * The NE event must be read and cleared first |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 168 | */ |
Mario Six | 9083b13 | 2019-04-29 01:58:52 +0530 | [diff] [blame] | 169 | start = get_timer(0); |
| 170 | do { |
Mario Six | 8d684ec | 2019-04-29 01:58:46 +0530 | [diff] [blame] | 171 | u32 event = in_be32(&spi->event); |
Mario Six | 4b671e1 | 2019-04-29 01:58:44 +0530 | [diff] [blame] | 172 | bool have_ne = event & SPI_EV_NE; |
| 173 | bool have_nf = event & SPI_EV_NF; |
| 174 | |
Mario Six | 2afedfe | 2019-04-29 01:58:45 +0530 | [diff] [blame] | 175 | if (!have_ne) |
| 176 | continue; |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 177 | |
Mario Six | 2afedfe | 2019-04-29 01:58:45 +0530 | [diff] [blame] | 178 | tmpdin = in_be32(&spi->rx); |
| 179 | setbits_be32(&spi->event, SPI_EV_NE); |
| 180 | |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 181 | if (cin) |
| 182 | *cin++ = tmpdin; |
Mario Six | 2afedfe | 2019-04-29 01:58:45 +0530 | [diff] [blame] | 183 | |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 184 | /* |
| 185 | * Only bail when we've had both NE and NF events. |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 186 | * This will cause timeouts on RO devices, so maybe |
| 187 | * in the future put an arbitrary delay after writing |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 188 | * the device. Arbitrary delays suck, though... |
| 189 | */ |
Mario Six | 2afedfe | 2019-04-29 01:58:45 +0530 | [diff] [blame] | 190 | if (have_nf) |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 191 | break; |
Mario Six | 9083b13 | 2019-04-29 01:58:52 +0530 | [diff] [blame] | 192 | |
| 193 | mdelay(1); |
| 194 | } while (get_timer(start) < SPI_TIMEOUT); |
Mario Six | 2afedfe | 2019-04-29 01:58:45 +0530 | [diff] [blame] | 195 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 196 | if (get_timer(start) >= SPI_TIMEOUT) { |
Mario Six | f9d5ca2 | 2019-04-29 01:58:40 +0530 | [diff] [blame] | 197 | debug("*** %s: Time out during SPI transfer\n", |
| 198 | __func__); |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 199 | return -ETIMEDOUT; |
| 200 | } |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 201 | |
Mario Six | f9d5ca2 | 2019-04-29 01:58:40 +0530 | [diff] [blame] | 202 | debug("*** %s: transfer ended. Value=%08x\n", __func__, tmpdin); |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 203 | } |
| 204 | |
Haavard Skinnemoen | d74084a | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 205 | if (flags & SPI_XFER_END) |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 206 | mpc8xxx_spi_cs_deactivate(dev); |
| 207 | |
| 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | static int mpc8xxx_spi_set_speed(struct udevice *dev, uint speed) |
| 212 | { |
Rasmus Villemoes | 1534031 | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 213 | struct mpc8xxx_priv *priv = dev_get_priv(dev); |
| 214 | spi8xxx_t *spi = priv->spi; |
| 215 | u32 bits, mask, div16, pm; |
| 216 | u32 mode; |
| 217 | ulong clk; |
| 218 | |
| 219 | clk = priv->clk_rate; |
| 220 | if (clk / 64 > speed) { |
| 221 | div16 = SPI_MODE_DIV16; |
| 222 | clk /= 16; |
| 223 | } else { |
| 224 | div16 = 0; |
| 225 | } |
| 226 | pm = (clk - 1)/(4*speed) + 1; |
| 227 | if (pm > 16) { |
| 228 | dev_err(dev, "requested speed %u too small\n", speed); |
| 229 | return -EINVAL; |
| 230 | } |
| 231 | pm--; |
| 232 | |
| 233 | bits = div16 | (pm << SPI_MODE_PM_SHIFT); |
| 234 | mask = SPI_MODE_DIV16 | SPI_MODE_PM_MASK; |
| 235 | mode = in_be32(&spi->mode); |
| 236 | if ((mode & mask) != bits) { |
| 237 | /* Must clear mode[EN] while changing speed. */ |
| 238 | mode &= ~(mask | SPI_MODE_EN); |
| 239 | out_be32(&spi->mode, mode); |
| 240 | mode |= bits; |
| 241 | out_be32(&spi->mode, mode); |
| 242 | mode |= SPI_MODE_EN; |
| 243 | out_be32(&spi->mode, mode); |
| 244 | } |
| 245 | |
| 246 | debug("requested speed %u, set speed to %lu/(%s4*%u) == %lu\n", |
| 247 | speed, priv->clk_rate, div16 ? "16*" : "", pm + 1, |
| 248 | clk/(4*(pm + 1))); |
| 249 | |
Rasmus Villemoes | 379e25d | 2020-02-11 15:20:25 +0000 | [diff] [blame] | 250 | return 0; |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 251 | } |
Kim Phillips | b8e2520 | 2008-01-17 12:48:00 -0600 | [diff] [blame] | 252 | |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 253 | static int mpc8xxx_spi_set_mode(struct udevice *dev, uint mode) |
| 254 | { |
| 255 | /* TODO(mario.six@gdsys.cc): Using SPI_CPHA (for clock phase) and |
| 256 | * SPI_CPOL (for clock polarity) should work |
| 257 | */ |
Ben Warren | 7efe927 | 2008-01-16 22:37:35 -0500 | [diff] [blame] | 258 | return 0; |
| 259 | } |
Jagan Teki | 52515d5 | 2019-04-29 01:58:53 +0530 | [diff] [blame] | 260 | |
| 261 | static const struct dm_spi_ops mpc8xxx_spi_ops = { |
| 262 | .xfer = mpc8xxx_spi_xfer, |
| 263 | .set_speed = mpc8xxx_spi_set_speed, |
| 264 | .set_mode = mpc8xxx_spi_set_mode, |
| 265 | /* |
| 266 | * cs_info is not needed, since we require all chip selects to be |
| 267 | * in the device tree explicitly |
| 268 | */ |
| 269 | }; |
| 270 | |
| 271 | static const struct udevice_id mpc8xxx_spi_ids[] = { |
| 272 | { .compatible = "fsl,spi" }, |
| 273 | { } |
| 274 | }; |
| 275 | |
| 276 | U_BOOT_DRIVER(mpc8xxx_spi) = { |
| 277 | .name = "mpc8xxx_spi", |
| 278 | .id = UCLASS_SPI, |
| 279 | .of_match = mpc8xxx_spi_ids, |
| 280 | .ops = &mpc8xxx_spi_ops, |
| 281 | .ofdata_to_platdata = mpc8xxx_spi_ofdata_to_platdata, |
| 282 | .probe = mpc8xxx_spi_probe, |
| 283 | .priv_auto_alloc_size = sizeof(struct mpc8xxx_priv), |
| 284 | }; |