Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'spi/topic/pxa2xx', 'spi/topic/qspi', 'spi/topic/s3c24xx', 'spi/topic/s3c64xx', 'spi/topic/sh', 'spi/topic/tegra114', 'spi/topic/tegra20-sflash', 'spi/topic/tegra20-slink', 'spi/topic/txx9' and 'spi/topic/xcomm' into spi-linus

+500 -1155
+7 -1
Documentation/devicetree/bindings/spi/ti_qspi.txt
··· 3 3 Required properties: 4 4 - compatible : should be "ti,dra7xxx-qspi" or "ti,am4372-qspi". 5 5 - reg: Should contain QSPI registers location and length. 6 + - reg-names: Should contain the resource reg names. 7 + - qspi_base: Qspi configuration register Address space 8 + - qspi_mmap: Memory mapped Address space 9 + - (optional) qspi_ctrlmod: Control module Address space 10 + - interrupts: should contain the qspi interrupt number. 6 11 - #address-cells, #size-cells : Must be present if the device has sub-nodes 7 12 - ti,hwmods: Name of the hwmod associated to the QSPI 8 13 ··· 19 14 20 15 qspi: qspi@4b300000 { 21 16 compatible = "ti,dra7xxx-qspi"; 22 - reg = <0x4b300000 0x100>; 17 + reg = <0x47900000 0x100>, <0x30000000 0x3ffffff>; 18 + reg-names = "qspi_base", "qspi_mmap"; 23 19 #address-cells = <1>; 24 20 #size-cells = <0>; 25 21 spi-max-frequency = <25000000>;
+1
arch/arm/Kconfig
··· 723 723 bool "Samsung S3C64XX" 724 724 select ARCH_HAS_CPUFREQ 725 725 select ARCH_REQUIRE_GPIOLIB 726 + select ARM_AMBA 726 727 select ARM_VIC 727 728 select CLKDEV_LOOKUP 728 729 select CLKSRC_SAMSUNG_PWM
+4 -3
arch/arm/mach-s3c64xx/Kconfig
··· 17 17 help 18 18 Enable S3C6410 CPU support 19 19 20 - config S3C64XX_DMA 21 - bool "S3C64XX DMA" 22 - select S3C_DMA 20 + config S3C64XX_PL080 21 + bool "S3C64XX DMA using generic PL08x driver" 22 + select AMBA_PL08X 23 + select SAMSUNG_DMADEV 23 24 24 25 config S3C64XX_SETUP_SDHCI 25 26 bool
+1 -1
arch/arm/mach-s3c64xx/Makefile
··· 26 26 27 27 # DMA support 28 28 29 - obj-$(CONFIG_S3C64XX_DMA) += dma.o 29 + obj-$(CONFIG_S3C64XX_PL080) += pl080.o 30 30 31 31 # Device support 32 32
+5
arch/arm/mach-s3c64xx/common.h
··· 58 58 static inline int s3c64xx_pm_late_initcall(void) { return 0; } 59 59 #endif 60 60 61 + #ifdef CONFIG_S3C64XX_PL080 62 + extern struct pl08x_platform_data s3c64xx_dma0_plat_data; 63 + extern struct pl08x_platform_data s3c64xx_dma1_plat_data; 64 + #endif 65 + 61 66 #endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
-762
arch/arm/mach-s3c64xx/dma.c
··· 1 - /* linux/arch/arm/plat-s3c64xx/dma.c 2 - * 3 - * Copyright 2009 Openmoko, Inc. 4 - * Copyright 2009 Simtec Electronics 5 - * Ben Dooks <ben@simtec.co.uk> 6 - * http://armlinux.simtec.co.uk/ 7 - * 8 - * S3C64XX DMA core 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - */ 14 - 15 - /* 16 - * NOTE: Code in this file is not used when booting with Device Tree support. 17 - */ 18 - 19 - #include <linux/kernel.h> 20 - #include <linux/module.h> 21 - #include <linux/interrupt.h> 22 - #include <linux/dmapool.h> 23 - #include <linux/device.h> 24 - #include <linux/errno.h> 25 - #include <linux/slab.h> 26 - #include <linux/delay.h> 27 - #include <linux/clk.h> 28 - #include <linux/err.h> 29 - #include <linux/io.h> 30 - #include <linux/amba/pl080.h> 31 - #include <linux/of.h> 32 - 33 - #include <mach/dma.h> 34 - #include <mach/map.h> 35 - #include <mach/irqs.h> 36 - 37 - #include "regs-sys.h" 38 - 39 - /* dma channel state information */ 40 - 41 - struct s3c64xx_dmac { 42 - struct device dev; 43 - struct clk *clk; 44 - void __iomem *regs; 45 - struct s3c2410_dma_chan *channels; 46 - enum dma_ch chanbase; 47 - }; 48 - 49 - /* pool to provide LLI buffers */ 50 - static struct dma_pool *dma_pool; 51 - 52 - /* Debug configuration and code */ 53 - 54 - static unsigned char debug_show_buffs = 0; 55 - 56 - static void dbg_showchan(struct s3c2410_dma_chan *chan) 57 - { 58 - pr_debug("DMA%d: %08x->%08x L %08x C %08x,%08x S %08x\n", 59 - chan->number, 60 - readl(chan->regs + PL080_CH_SRC_ADDR), 61 - readl(chan->regs + PL080_CH_DST_ADDR), 62 - readl(chan->regs + PL080_CH_LLI), 63 - readl(chan->regs + PL080_CH_CONTROL), 64 - readl(chan->regs + PL080S_CH_CONTROL2), 65 - readl(chan->regs + PL080S_CH_CONFIG)); 66 - } 67 - 68 - static void show_lli(struct pl080s_lli *lli) 69 - { 70 - pr_debug("LLI[%p] %08x->%08x, NL %08x C %08x,%08x\n", 71 - lli, lli->src_addr, lli->dst_addr, lli->next_lli, 72 - lli->control0, lli->control1); 73 - } 74 - 75 - static void dbg_showbuffs(struct s3c2410_dma_chan *chan) 76 - { 77 - struct s3c64xx_dma_buff *ptr; 78 - struct s3c64xx_dma_buff *end; 79 - 80 - pr_debug("DMA%d: buffs next %p, curr %p, end %p\n", 81 - chan->number, chan->next, chan->curr, chan->end); 82 - 83 - ptr = chan->next; 84 - end = chan->end; 85 - 86 - if (debug_show_buffs) { 87 - for (; ptr != NULL; ptr = ptr->next) { 88 - pr_debug("DMA%d: %08x ", 89 - chan->number, ptr->lli_dma); 90 - show_lli(ptr->lli); 91 - } 92 - } 93 - } 94 - 95 - /* End of Debug */ 96 - 97 - static struct s3c2410_dma_chan *s3c64xx_dma_map_channel(unsigned int channel) 98 - { 99 - struct s3c2410_dma_chan *chan; 100 - unsigned int start, offs; 101 - 102 - start = 0; 103 - 104 - if (channel >= DMACH_PCM1_TX) 105 - start = 8; 106 - 107 - for (offs = 0; offs < 8; offs++) { 108 - chan = &s3c2410_chans[start + offs]; 109 - if (!chan->in_use) 110 - goto found; 111 - } 112 - 113 - return NULL; 114 - 115 - found: 116 - s3c_dma_chan_map[channel] = chan; 117 - return chan; 118 - } 119 - 120 - int s3c2410_dma_config(enum dma_ch channel, int xferunit) 121 - { 122 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 123 - 124 - if (chan == NULL) 125 - return -EINVAL; 126 - 127 - switch (xferunit) { 128 - case 1: 129 - chan->hw_width = 0; 130 - break; 131 - case 2: 132 - chan->hw_width = 1; 133 - break; 134 - case 4: 135 - chan->hw_width = 2; 136 - break; 137 - default: 138 - printk(KERN_ERR "%s: illegal width %d\n", __func__, xferunit); 139 - return -EINVAL; 140 - } 141 - 142 - return 0; 143 - } 144 - EXPORT_SYMBOL(s3c2410_dma_config); 145 - 146 - static void s3c64xx_dma_fill_lli(struct s3c2410_dma_chan *chan, 147 - struct pl080s_lli *lli, 148 - dma_addr_t data, int size) 149 - { 150 - dma_addr_t src, dst; 151 - u32 control0, control1; 152 - 153 - switch (chan->source) { 154 - case DMA_FROM_DEVICE: 155 - src = chan->dev_addr; 156 - dst = data; 157 - control0 = PL080_CONTROL_SRC_AHB2; 158 - control0 |= PL080_CONTROL_DST_INCR; 159 - break; 160 - 161 - case DMA_TO_DEVICE: 162 - src = data; 163 - dst = chan->dev_addr; 164 - control0 = PL080_CONTROL_DST_AHB2; 165 - control0 |= PL080_CONTROL_SRC_INCR; 166 - break; 167 - default: 168 - BUG(); 169 - } 170 - 171 - /* note, we do not currently setup any of the burst controls */ 172 - 173 - control1 = size >> chan->hw_width; /* size in no of xfers */ 174 - control0 |= PL080_CONTROL_PROT_SYS; /* always in priv. mode */ 175 - control0 |= PL080_CONTROL_TC_IRQ_EN; /* always fire IRQ */ 176 - control0 |= (u32)chan->hw_width << PL080_CONTROL_DWIDTH_SHIFT; 177 - control0 |= (u32)chan->hw_width << PL080_CONTROL_SWIDTH_SHIFT; 178 - 179 - lli->src_addr = src; 180 - lli->dst_addr = dst; 181 - lli->next_lli = 0; 182 - lli->control0 = control0; 183 - lli->control1 = control1; 184 - } 185 - 186 - static void s3c64xx_lli_to_regs(struct s3c2410_dma_chan *chan, 187 - struct pl080s_lli *lli) 188 - { 189 - void __iomem *regs = chan->regs; 190 - 191 - pr_debug("%s: LLI %p => regs\n", __func__, lli); 192 - show_lli(lli); 193 - 194 - writel(lli->src_addr, regs + PL080_CH_SRC_ADDR); 195 - writel(lli->dst_addr, regs + PL080_CH_DST_ADDR); 196 - writel(lli->next_lli, regs + PL080_CH_LLI); 197 - writel(lli->control0, regs + PL080_CH_CONTROL); 198 - writel(lli->control1, regs + PL080S_CH_CONTROL2); 199 - } 200 - 201 - static int s3c64xx_dma_start(struct s3c2410_dma_chan *chan) 202 - { 203 - struct s3c64xx_dmac *dmac = chan->dmac; 204 - u32 config; 205 - u32 bit = chan->bit; 206 - 207 - dbg_showchan(chan); 208 - 209 - pr_debug("%s: clearing interrupts\n", __func__); 210 - 211 - /* clear interrupts */ 212 - writel(bit, dmac->regs + PL080_TC_CLEAR); 213 - writel(bit, dmac->regs + PL080_ERR_CLEAR); 214 - 215 - pr_debug("%s: starting channel\n", __func__); 216 - 217 - config = readl(chan->regs + PL080S_CH_CONFIG); 218 - config |= PL080_CONFIG_ENABLE; 219 - config &= ~PL080_CONFIG_HALT; 220 - 221 - pr_debug("%s: writing config %08x\n", __func__, config); 222 - writel(config, chan->regs + PL080S_CH_CONFIG); 223 - 224 - return 0; 225 - } 226 - 227 - static int s3c64xx_dma_stop(struct s3c2410_dma_chan *chan) 228 - { 229 - u32 config; 230 - int timeout; 231 - 232 - pr_debug("%s: stopping channel\n", __func__); 233 - 234 - dbg_showchan(chan); 235 - 236 - config = readl(chan->regs + PL080S_CH_CONFIG); 237 - config |= PL080_CONFIG_HALT; 238 - writel(config, chan->regs + PL080S_CH_CONFIG); 239 - 240 - timeout = 1000; 241 - do { 242 - config = readl(chan->regs + PL080S_CH_CONFIG); 243 - pr_debug("%s: %d - config %08x\n", __func__, timeout, config); 244 - if (config & PL080_CONFIG_ACTIVE) 245 - udelay(10); 246 - else 247 - break; 248 - } while (--timeout > 0); 249 - 250 - if (config & PL080_CONFIG_ACTIVE) { 251 - printk(KERN_ERR "%s: channel still active\n", __func__); 252 - return -EFAULT; 253 - } 254 - 255 - config = readl(chan->regs + PL080S_CH_CONFIG); 256 - config &= ~PL080_CONFIG_ENABLE; 257 - writel(config, chan->regs + PL080S_CH_CONFIG); 258 - 259 - return 0; 260 - } 261 - 262 - static inline void s3c64xx_dma_bufffdone(struct s3c2410_dma_chan *chan, 263 - struct s3c64xx_dma_buff *buf, 264 - enum s3c2410_dma_buffresult result) 265 - { 266 - if (chan->callback_fn != NULL) 267 - (chan->callback_fn)(chan, buf->pw, 0, result); 268 - } 269 - 270 - static void s3c64xx_dma_freebuff(struct s3c64xx_dma_buff *buff) 271 - { 272 - dma_pool_free(dma_pool, buff->lli, buff->lli_dma); 273 - kfree(buff); 274 - } 275 - 276 - static int s3c64xx_dma_flush(struct s3c2410_dma_chan *chan) 277 - { 278 - struct s3c64xx_dma_buff *buff, *next; 279 - u32 config; 280 - 281 - dbg_showchan(chan); 282 - 283 - pr_debug("%s: flushing channel\n", __func__); 284 - 285 - config = readl(chan->regs + PL080S_CH_CONFIG); 286 - config &= ~PL080_CONFIG_ENABLE; 287 - writel(config, chan->regs + PL080S_CH_CONFIG); 288 - 289 - /* dump all the buffers associated with this channel */ 290 - 291 - for (buff = chan->curr; buff != NULL; buff = next) { 292 - next = buff->next; 293 - pr_debug("%s: buff %p (next %p)\n", __func__, buff, buff->next); 294 - 295 - s3c64xx_dma_bufffdone(chan, buff, S3C2410_RES_ABORT); 296 - s3c64xx_dma_freebuff(buff); 297 - } 298 - 299 - chan->curr = chan->next = chan->end = NULL; 300 - 301 - return 0; 302 - } 303 - 304 - int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op) 305 - { 306 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 307 - 308 - WARN_ON(!chan); 309 - if (!chan) 310 - return -EINVAL; 311 - 312 - switch (op) { 313 - case S3C2410_DMAOP_START: 314 - return s3c64xx_dma_start(chan); 315 - 316 - case S3C2410_DMAOP_STOP: 317 - return s3c64xx_dma_stop(chan); 318 - 319 - case S3C2410_DMAOP_FLUSH: 320 - return s3c64xx_dma_flush(chan); 321 - 322 - /* believe PAUSE/RESUME are no-ops */ 323 - case S3C2410_DMAOP_PAUSE: 324 - case S3C2410_DMAOP_RESUME: 325 - case S3C2410_DMAOP_STARTED: 326 - case S3C2410_DMAOP_TIMEOUT: 327 - return 0; 328 - } 329 - 330 - return -ENOENT; 331 - } 332 - EXPORT_SYMBOL(s3c2410_dma_ctrl); 333 - 334 - /* s3c2410_dma_enque 335 - * 336 - */ 337 - 338 - int s3c2410_dma_enqueue(enum dma_ch channel, void *id, 339 - dma_addr_t data, int size) 340 - { 341 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 342 - struct s3c64xx_dma_buff *next; 343 - struct s3c64xx_dma_buff *buff; 344 - struct pl080s_lli *lli; 345 - unsigned long flags; 346 - int ret; 347 - 348 - WARN_ON(!chan); 349 - if (!chan) 350 - return -EINVAL; 351 - 352 - buff = kzalloc(sizeof(struct s3c64xx_dma_buff), GFP_ATOMIC); 353 - if (!buff) { 354 - printk(KERN_ERR "%s: no memory for buffer\n", __func__); 355 - return -ENOMEM; 356 - } 357 - 358 - lli = dma_pool_alloc(dma_pool, GFP_ATOMIC, &buff->lli_dma); 359 - if (!lli) { 360 - printk(KERN_ERR "%s: no memory for lli\n", __func__); 361 - ret = -ENOMEM; 362 - goto err_buff; 363 - } 364 - 365 - pr_debug("%s: buff %p, dp %08x lli (%p, %08x) %d\n", 366 - __func__, buff, data, lli, (u32)buff->lli_dma, size); 367 - 368 - buff->lli = lli; 369 - buff->pw = id; 370 - 371 - s3c64xx_dma_fill_lli(chan, lli, data, size); 372 - 373 - local_irq_save(flags); 374 - 375 - if ((next = chan->next) != NULL) { 376 - struct s3c64xx_dma_buff *end = chan->end; 377 - struct pl080s_lli *endlli = end->lli; 378 - 379 - pr_debug("enquing onto channel\n"); 380 - 381 - end->next = buff; 382 - endlli->next_lli = buff->lli_dma; 383 - 384 - if (chan->flags & S3C2410_DMAF_CIRCULAR) { 385 - struct s3c64xx_dma_buff *curr = chan->curr; 386 - lli->next_lli = curr->lli_dma; 387 - } 388 - 389 - if (next == chan->curr) { 390 - writel(buff->lli_dma, chan->regs + PL080_CH_LLI); 391 - chan->next = buff; 392 - } 393 - 394 - show_lli(endlli); 395 - chan->end = buff; 396 - } else { 397 - pr_debug("enquing onto empty channel\n"); 398 - 399 - chan->curr = buff; 400 - chan->next = buff; 401 - chan->end = buff; 402 - 403 - s3c64xx_lli_to_regs(chan, lli); 404 - } 405 - 406 - local_irq_restore(flags); 407 - 408 - show_lli(lli); 409 - 410 - dbg_showchan(chan); 411 - dbg_showbuffs(chan); 412 - return 0; 413 - 414 - err_buff: 415 - kfree(buff); 416 - return ret; 417 - } 418 - 419 - EXPORT_SYMBOL(s3c2410_dma_enqueue); 420 - 421 - 422 - int s3c2410_dma_devconfig(enum dma_ch channel, 423 - enum dma_data_direction source, 424 - unsigned long devaddr) 425 - { 426 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 427 - u32 peripheral; 428 - u32 config = 0; 429 - 430 - pr_debug("%s: channel %d, source %d, dev %08lx, chan %p\n", 431 - __func__, channel, source, devaddr, chan); 432 - 433 - WARN_ON(!chan); 434 - if (!chan) 435 - return -EINVAL; 436 - 437 - peripheral = (chan->peripheral & 0xf); 438 - chan->source = source; 439 - chan->dev_addr = devaddr; 440 - 441 - pr_debug("%s: peripheral %d\n", __func__, peripheral); 442 - 443 - switch (source) { 444 - case DMA_FROM_DEVICE: 445 - config = 2 << PL080_CONFIG_FLOW_CONTROL_SHIFT; 446 - config |= peripheral << PL080_CONFIG_SRC_SEL_SHIFT; 447 - break; 448 - case DMA_TO_DEVICE: 449 - config = 1 << PL080_CONFIG_FLOW_CONTROL_SHIFT; 450 - config |= peripheral << PL080_CONFIG_DST_SEL_SHIFT; 451 - break; 452 - default: 453 - printk(KERN_ERR "%s: bad source\n", __func__); 454 - return -EINVAL; 455 - } 456 - 457 - /* allow TC and ERR interrupts */ 458 - config |= PL080_CONFIG_TC_IRQ_MASK; 459 - config |= PL080_CONFIG_ERR_IRQ_MASK; 460 - 461 - pr_debug("%s: config %08x\n", __func__, config); 462 - 463 - writel(config, chan->regs + PL080S_CH_CONFIG); 464 - 465 - return 0; 466 - } 467 - EXPORT_SYMBOL(s3c2410_dma_devconfig); 468 - 469 - 470 - int s3c2410_dma_getposition(enum dma_ch channel, 471 - dma_addr_t *src, dma_addr_t *dst) 472 - { 473 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 474 - 475 - WARN_ON(!chan); 476 - if (!chan) 477 - return -EINVAL; 478 - 479 - if (src != NULL) 480 - *src = readl(chan->regs + PL080_CH_SRC_ADDR); 481 - 482 - if (dst != NULL) 483 - *dst = readl(chan->regs + PL080_CH_DST_ADDR); 484 - 485 - return 0; 486 - } 487 - EXPORT_SYMBOL(s3c2410_dma_getposition); 488 - 489 - /* s3c2410_request_dma 490 - * 491 - * get control of an dma channel 492 - */ 493 - 494 - int s3c2410_dma_request(enum dma_ch channel, 495 - struct s3c2410_dma_client *client, 496 - void *dev) 497 - { 498 - struct s3c2410_dma_chan *chan; 499 - unsigned long flags; 500 - 501 - pr_debug("dma%d: s3c2410_request_dma: client=%s, dev=%p\n", 502 - channel, client->name, dev); 503 - 504 - local_irq_save(flags); 505 - 506 - chan = s3c64xx_dma_map_channel(channel); 507 - if (chan == NULL) { 508 - local_irq_restore(flags); 509 - return -EBUSY; 510 - } 511 - 512 - dbg_showchan(chan); 513 - 514 - chan->client = client; 515 - chan->in_use = 1; 516 - chan->peripheral = channel; 517 - chan->flags = 0; 518 - 519 - local_irq_restore(flags); 520 - 521 - /* need to setup */ 522 - 523 - pr_debug("%s: channel initialised, %p\n", __func__, chan); 524 - 525 - return chan->number | DMACH_LOW_LEVEL; 526 - } 527 - 528 - EXPORT_SYMBOL(s3c2410_dma_request); 529 - 530 - /* s3c2410_dma_free 531 - * 532 - * release the given channel back to the system, will stop and flush 533 - * any outstanding transfers, and ensure the channel is ready for the 534 - * next claimant. 535 - * 536 - * Note, although a warning is currently printed if the freeing client 537 - * info is not the same as the registrant's client info, the free is still 538 - * allowed to go through. 539 - */ 540 - 541 - int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client) 542 - { 543 - struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 544 - unsigned long flags; 545 - 546 - if (chan == NULL) 547 - return -EINVAL; 548 - 549 - local_irq_save(flags); 550 - 551 - if (chan->client != client) { 552 - printk(KERN_WARNING "dma%d: possible free from different client (channel %p, passed %p)\n", 553 - channel, chan->client, client); 554 - } 555 - 556 - /* sort out stopping and freeing the channel */ 557 - 558 - 559 - chan->client = NULL; 560 - chan->in_use = 0; 561 - 562 - if (!(channel & DMACH_LOW_LEVEL)) 563 - s3c_dma_chan_map[channel] = NULL; 564 - 565 - local_irq_restore(flags); 566 - 567 - return 0; 568 - } 569 - 570 - EXPORT_SYMBOL(s3c2410_dma_free); 571 - 572 - static irqreturn_t s3c64xx_dma_irq(int irq, void *pw) 573 - { 574 - struct s3c64xx_dmac *dmac = pw; 575 - struct s3c2410_dma_chan *chan; 576 - enum s3c2410_dma_buffresult res; 577 - u32 tcstat, errstat; 578 - u32 bit; 579 - int offs; 580 - 581 - tcstat = readl(dmac->regs + PL080_TC_STATUS); 582 - errstat = readl(dmac->regs + PL080_ERR_STATUS); 583 - 584 - for (offs = 0, bit = 1; offs < 8; offs++, bit <<= 1) { 585 - struct s3c64xx_dma_buff *buff; 586 - 587 - if (!(errstat & bit) && !(tcstat & bit)) 588 - continue; 589 - 590 - chan = dmac->channels + offs; 591 - res = S3C2410_RES_ERR; 592 - 593 - if (tcstat & bit) { 594 - writel(bit, dmac->regs + PL080_TC_CLEAR); 595 - res = S3C2410_RES_OK; 596 - } 597 - 598 - if (errstat & bit) 599 - writel(bit, dmac->regs + PL080_ERR_CLEAR); 600 - 601 - /* 'next' points to the buffer that is next to the 602 - * currently active buffer. 603 - * For CIRCULAR queues, 'next' will be same as 'curr' 604 - * when 'end' is the active buffer. 605 - */ 606 - buff = chan->curr; 607 - while (buff && buff != chan->next 608 - && buff->next != chan->next) 609 - buff = buff->next; 610 - 611 - if (!buff) 612 - BUG(); 613 - 614 - if (buff == chan->next) 615 - buff = chan->end; 616 - 617 - s3c64xx_dma_bufffdone(chan, buff, res); 618 - 619 - /* Free the node and update curr, if non-circular queue */ 620 - if (!(chan->flags & S3C2410_DMAF_CIRCULAR)) { 621 - chan->curr = buff->next; 622 - s3c64xx_dma_freebuff(buff); 623 - } 624 - 625 - /* Update 'next' */ 626 - buff = chan->next; 627 - if (chan->next == chan->end) { 628 - chan->next = chan->curr; 629 - if (!(chan->flags & S3C2410_DMAF_CIRCULAR)) 630 - chan->end = NULL; 631 - } else { 632 - chan->next = buff->next; 633 - } 634 - } 635 - 636 - return IRQ_HANDLED; 637 - } 638 - 639 - static struct bus_type dma_subsys = { 640 - .name = "s3c64xx-dma", 641 - .dev_name = "s3c64xx-dma", 642 - }; 643 - 644 - static int s3c64xx_dma_init1(int chno, enum dma_ch chbase, 645 - int irq, unsigned int base) 646 - { 647 - struct s3c2410_dma_chan *chptr = &s3c2410_chans[chno]; 648 - struct s3c64xx_dmac *dmac; 649 - char clkname[16]; 650 - void __iomem *regs; 651 - void __iomem *regptr; 652 - int err, ch; 653 - 654 - dmac = kzalloc(sizeof(struct s3c64xx_dmac), GFP_KERNEL); 655 - if (!dmac) { 656 - printk(KERN_ERR "%s: failed to alloc mem\n", __func__); 657 - return -ENOMEM; 658 - } 659 - 660 - dmac->dev.id = chno / 8; 661 - dmac->dev.bus = &dma_subsys; 662 - 663 - err = device_register(&dmac->dev); 664 - if (err) { 665 - printk(KERN_ERR "%s: failed to register device\n", __func__); 666 - goto err_alloc; 667 - } 668 - 669 - regs = ioremap(base, 0x200); 670 - if (!regs) { 671 - printk(KERN_ERR "%s: failed to ioremap()\n", __func__); 672 - err = -ENXIO; 673 - goto err_dev; 674 - } 675 - 676 - snprintf(clkname, sizeof(clkname), "dma%d", dmac->dev.id); 677 - 678 - dmac->clk = clk_get(NULL, clkname); 679 - if (IS_ERR(dmac->clk)) { 680 - printk(KERN_ERR "%s: failed to get clock %s\n", __func__, clkname); 681 - err = PTR_ERR(dmac->clk); 682 - goto err_map; 683 - } 684 - 685 - clk_prepare_enable(dmac->clk); 686 - 687 - dmac->regs = regs; 688 - dmac->chanbase = chbase; 689 - dmac->channels = chptr; 690 - 691 - err = request_irq(irq, s3c64xx_dma_irq, 0, "DMA", dmac); 692 - if (err < 0) { 693 - printk(KERN_ERR "%s: failed to get irq\n", __func__); 694 - goto err_clk; 695 - } 696 - 697 - regptr = regs + PL080_Cx_BASE(0); 698 - 699 - for (ch = 0; ch < 8; ch++, chptr++) { 700 - pr_debug("%s: registering DMA %d (%p)\n", 701 - __func__, chno + ch, regptr); 702 - 703 - chptr->bit = 1 << ch; 704 - chptr->number = chno + ch; 705 - chptr->dmac = dmac; 706 - chptr->regs = regptr; 707 - regptr += PL080_Cx_STRIDE; 708 - } 709 - 710 - /* for the moment, permanently enable the controller */ 711 - writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG); 712 - 713 - printk(KERN_INFO "PL080: IRQ %d, at %p, channels %d..%d\n", 714 - irq, regs, chno, chno+8); 715 - 716 - return 0; 717 - 718 - err_clk: 719 - clk_disable_unprepare(dmac->clk); 720 - clk_put(dmac->clk); 721 - err_map: 722 - iounmap(regs); 723 - err_dev: 724 - device_unregister(&dmac->dev); 725 - err_alloc: 726 - kfree(dmac); 727 - return err; 728 - } 729 - 730 - static int __init s3c64xx_dma_init(void) 731 - { 732 - int ret; 733 - 734 - /* This driver is not supported when booting with device tree. */ 735 - if (of_have_populated_dt()) 736 - return -ENODEV; 737 - 738 - printk(KERN_INFO "%s: Registering DMA channels\n", __func__); 739 - 740 - dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0); 741 - if (!dma_pool) { 742 - printk(KERN_ERR "%s: failed to create pool\n", __func__); 743 - return -ENOMEM; 744 - } 745 - 746 - ret = subsys_system_register(&dma_subsys, NULL); 747 - if (ret) { 748 - printk(KERN_ERR "%s: failed to create subsys\n", __func__); 749 - return -ENOMEM; 750 - } 751 - 752 - /* Set all DMA configuration to be DMA, not SDMA */ 753 - writel(0xffffff, S3C64XX_SDMA_SEL); 754 - 755 - /* Register standard DMA controllers */ 756 - s3c64xx_dma_init1(0, DMACH_UART0, IRQ_DMA0, 0x75000000); 757 - s3c64xx_dma_init1(8, DMACH_PCM1_TX, IRQ_DMA1, 0x75100000); 758 - 759 - return 0; 760 - } 761 - 762 - arch_initcall(s3c64xx_dma_init);
+41 -101
arch/arm/mach-s3c64xx/include/mach/dma.h
··· 11 11 #ifndef __ASM_ARCH_DMA_H 12 12 #define __ASM_ARCH_DMA_H __FILE__ 13 13 14 - #define S3C_DMA_CHANNELS (16) 14 + #define S3C64XX_DMA_CHAN(name) ((unsigned long)(name)) 15 15 16 - /* see mach-s3c2410/dma.h for notes on dma channel numbers */ 16 + /* DMA0/SDMA0 */ 17 + #define DMACH_UART0 S3C64XX_DMA_CHAN("uart0_tx") 18 + #define DMACH_UART0_SRC2 S3C64XX_DMA_CHAN("uart0_rx") 19 + #define DMACH_UART1 S3C64XX_DMA_CHAN("uart1_tx") 20 + #define DMACH_UART1_SRC2 S3C64XX_DMA_CHAN("uart1_rx") 21 + #define DMACH_UART2 S3C64XX_DMA_CHAN("uart2_tx") 22 + #define DMACH_UART2_SRC2 S3C64XX_DMA_CHAN("uart2_rx") 23 + #define DMACH_UART3 S3C64XX_DMA_CHAN("uart3_tx") 24 + #define DMACH_UART3_SRC2 S3C64XX_DMA_CHAN("uart3_rx") 25 + #define DMACH_PCM0_TX S3C64XX_DMA_CHAN("pcm0_tx") 26 + #define DMACH_PCM0_RX S3C64XX_DMA_CHAN("pcm0_rx") 27 + #define DMACH_I2S0_OUT S3C64XX_DMA_CHAN("i2s0_tx") 28 + #define DMACH_I2S0_IN S3C64XX_DMA_CHAN("i2s0_rx") 29 + #define DMACH_SPI0_TX S3C64XX_DMA_CHAN("spi0_tx") 30 + #define DMACH_SPI0_RX S3C64XX_DMA_CHAN("spi0_rx") 31 + #define DMACH_HSI_I2SV40_TX S3C64XX_DMA_CHAN("i2s2_tx") 32 + #define DMACH_HSI_I2SV40_RX S3C64XX_DMA_CHAN("i2s2_rx") 17 33 18 - /* Note, for the S3C64XX architecture we keep the DMACH_ 19 - * defines in the order they are allocated to [S]DMA0/[S]DMA1 20 - * so that is easy to do DHACH_ -> DMA controller conversion 21 - */ 34 + /* DMA1/SDMA1 */ 35 + #define DMACH_PCM1_TX S3C64XX_DMA_CHAN("pcm1_tx") 36 + #define DMACH_PCM1_RX S3C64XX_DMA_CHAN("pcm1_rx") 37 + #define DMACH_I2S1_OUT S3C64XX_DMA_CHAN("i2s1_tx") 38 + #define DMACH_I2S1_IN S3C64XX_DMA_CHAN("i2s1_rx") 39 + #define DMACH_SPI1_TX S3C64XX_DMA_CHAN("spi1_tx") 40 + #define DMACH_SPI1_RX S3C64XX_DMA_CHAN("spi1_rx") 41 + #define DMACH_AC97_PCMOUT S3C64XX_DMA_CHAN("ac97_out") 42 + #define DMACH_AC97_PCMIN S3C64XX_DMA_CHAN("ac97_in") 43 + #define DMACH_AC97_MICIN S3C64XX_DMA_CHAN("ac97_mic") 44 + #define DMACH_PWM S3C64XX_DMA_CHAN("pwm") 45 + #define DMACH_IRDA S3C64XX_DMA_CHAN("irda") 46 + #define DMACH_EXTERNAL S3C64XX_DMA_CHAN("external") 47 + #define DMACH_SECURITY_RX S3C64XX_DMA_CHAN("sec_rx") 48 + #define DMACH_SECURITY_TX S3C64XX_DMA_CHAN("sec_tx") 49 + 22 50 enum dma_ch { 23 - /* DMA0/SDMA0 */ 24 - DMACH_UART0 = 0, 25 - DMACH_UART0_SRC2, 26 - DMACH_UART1, 27 - DMACH_UART1_SRC2, 28 - DMACH_UART2, 29 - DMACH_UART2_SRC2, 30 - DMACH_UART3, 31 - DMACH_UART3_SRC2, 32 - DMACH_PCM0_TX, 33 - DMACH_PCM0_RX, 34 - DMACH_I2S0_OUT, 35 - DMACH_I2S0_IN, 36 - DMACH_SPI0_TX, 37 - DMACH_SPI0_RX, 38 - DMACH_HSI_I2SV40_TX, 39 - DMACH_HSI_I2SV40_RX, 51 + DMACH_MAX = 32 52 + }; 40 53 41 - /* DMA1/SDMA1 */ 42 - DMACH_PCM1_TX = 16, 43 - DMACH_PCM1_RX, 44 - DMACH_I2S1_OUT, 45 - DMACH_I2S1_IN, 46 - DMACH_SPI1_TX, 47 - DMACH_SPI1_RX, 48 - DMACH_AC97_PCMOUT, 49 - DMACH_AC97_PCMIN, 50 - DMACH_AC97_MICIN, 51 - DMACH_PWM, 52 - DMACH_IRDA, 53 - DMACH_EXTERNAL, 54 - DMACH_RES1, 55 - DMACH_RES2, 56 - DMACH_SECURITY_RX, /* SDMA1 only */ 57 - DMACH_SECURITY_TX, /* SDMA1 only */ 58 - DMACH_MAX /* the end */ 54 + struct s3c2410_dma_client { 55 + char *name; 59 56 }; 60 57 61 58 static inline bool samsung_dma_has_circular(void) ··· 62 65 63 66 static inline bool samsung_dma_is_dmadev(void) 64 67 { 65 - return false; 68 + return true; 66 69 } 67 - #define S3C2410_DMAF_CIRCULAR (1 << 0) 68 70 69 - #include <plat/dma.h> 70 - 71 - #define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */ 72 - 73 - struct s3c64xx_dma_buff; 74 - 75 - /** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor 76 - * @next: Pointer to next buffer in queue or ring. 77 - * @pw: Client provided identifier 78 - * @lli: Pointer to hardware descriptor this buffer is associated with. 79 - * @lli_dma: Hardare address of the descriptor. 80 - */ 81 - struct s3c64xx_dma_buff { 82 - struct s3c64xx_dma_buff *next; 83 - 84 - void *pw; 85 - struct pl080s_lli *lli; 86 - dma_addr_t lli_dma; 87 - }; 88 - 89 - struct s3c64xx_dmac; 90 - 91 - struct s3c2410_dma_chan { 92 - unsigned char number; /* number of this dma channel */ 93 - unsigned char in_use; /* channel allocated */ 94 - unsigned char bit; /* bit for enable/disable/etc */ 95 - unsigned char hw_width; 96 - unsigned char peripheral; 97 - 98 - unsigned int flags; 99 - enum dma_data_direction source; 100 - 101 - 102 - dma_addr_t dev_addr; 103 - 104 - struct s3c2410_dma_client *client; 105 - struct s3c64xx_dmac *dmac; /* pointer to controller */ 106 - 107 - void __iomem *regs; 108 - 109 - /* cdriver callbacks */ 110 - s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */ 111 - s3c2410_dma_opfn_t op_fn; /* channel op callback */ 112 - 113 - /* buffer list and information */ 114 - struct s3c64xx_dma_buff *curr; /* current dma buffer */ 115 - struct s3c64xx_dma_buff *next; /* next buffer to load */ 116 - struct s3c64xx_dma_buff *end; /* end of queue */ 117 - 118 - /* note, when channel is running in circular mode, curr is the 119 - * first buffer enqueued, end is the last and curr is where the 120 - * last buffer-done event is set-at. The buffers are not freed 121 - * and the last buffer hardware descriptor points back to the 122 - * first. 123 - */ 124 - }; 125 - 126 - #include <plat/dma-core.h> 71 + #include <linux/amba/pl08x.h> 72 + #include <plat/dma-ops.h> 127 73 128 74 #endif /* __ASM_ARCH_IRQ_H */
+244
arch/arm/mach-s3c64xx/pl080.c
··· 1 + /* 2 + * Samsung's S3C64XX generic DMA support using amba-pl08x driver. 3 + * 4 + * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com> 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 version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/kernel.h> 12 + #include <linux/amba/bus.h> 13 + #include <linux/amba/pl080.h> 14 + #include <linux/amba/pl08x.h> 15 + #include <linux/of.h> 16 + 17 + #include <mach/irqs.h> 18 + #include <mach/map.h> 19 + 20 + #include "regs-sys.h" 21 + 22 + static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd) 23 + { 24 + return cd->min_signal; 25 + } 26 + 27 + static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch) 28 + { 29 + } 30 + 31 + /* 32 + * DMA0 33 + */ 34 + 35 + static struct pl08x_channel_data s3c64xx_dma0_info[] = { 36 + { 37 + .bus_id = "uart0_tx", 38 + .min_signal = 0, 39 + .max_signal = 0, 40 + .periph_buses = PL08X_AHB2, 41 + }, { 42 + .bus_id = "uart0_rx", 43 + .min_signal = 1, 44 + .max_signal = 1, 45 + .periph_buses = PL08X_AHB2, 46 + }, { 47 + .bus_id = "uart1_tx", 48 + .min_signal = 2, 49 + .max_signal = 2, 50 + .periph_buses = PL08X_AHB2, 51 + }, { 52 + .bus_id = "uart1_rx", 53 + .min_signal = 3, 54 + .max_signal = 3, 55 + .periph_buses = PL08X_AHB2, 56 + }, { 57 + .bus_id = "uart2_tx", 58 + .min_signal = 4, 59 + .max_signal = 4, 60 + .periph_buses = PL08X_AHB2, 61 + }, { 62 + .bus_id = "uart2_rx", 63 + .min_signal = 5, 64 + .max_signal = 5, 65 + .periph_buses = PL08X_AHB2, 66 + }, { 67 + .bus_id = "uart3_tx", 68 + .min_signal = 6, 69 + .max_signal = 6, 70 + .periph_buses = PL08X_AHB2, 71 + }, { 72 + .bus_id = "uart3_rx", 73 + .min_signal = 7, 74 + .max_signal = 7, 75 + .periph_buses = PL08X_AHB2, 76 + }, { 77 + .bus_id = "pcm0_tx", 78 + .min_signal = 8, 79 + .max_signal = 8, 80 + .periph_buses = PL08X_AHB2, 81 + }, { 82 + .bus_id = "pcm0_rx", 83 + .min_signal = 9, 84 + .max_signal = 9, 85 + .periph_buses = PL08X_AHB2, 86 + }, { 87 + .bus_id = "i2s0_tx", 88 + .min_signal = 10, 89 + .max_signal = 10, 90 + .periph_buses = PL08X_AHB2, 91 + }, { 92 + .bus_id = "i2s0_rx", 93 + .min_signal = 11, 94 + .max_signal = 11, 95 + .periph_buses = PL08X_AHB2, 96 + }, { 97 + .bus_id = "spi0_tx", 98 + .min_signal = 12, 99 + .max_signal = 12, 100 + .periph_buses = PL08X_AHB2, 101 + }, { 102 + .bus_id = "spi0_rx", 103 + .min_signal = 13, 104 + .max_signal = 13, 105 + .periph_buses = PL08X_AHB2, 106 + }, { 107 + .bus_id = "i2s2_tx", 108 + .min_signal = 14, 109 + .max_signal = 14, 110 + .periph_buses = PL08X_AHB2, 111 + }, { 112 + .bus_id = "i2s2_rx", 113 + .min_signal = 15, 114 + .max_signal = 15, 115 + .periph_buses = PL08X_AHB2, 116 + } 117 + }; 118 + 119 + struct pl08x_platform_data s3c64xx_dma0_plat_data = { 120 + .memcpy_channel = { 121 + .bus_id = "memcpy", 122 + .cctl_memcpy = 123 + (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT | 124 + PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT | 125 + PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | 126 + PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | 127 + PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | 128 + PL080_CONTROL_PROT_SYS), 129 + }, 130 + .lli_buses = PL08X_AHB1, 131 + .mem_buses = PL08X_AHB1, 132 + .get_xfer_signal = pl08x_get_xfer_signal, 133 + .put_xfer_signal = pl08x_put_xfer_signal, 134 + .slave_channels = s3c64xx_dma0_info, 135 + .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info), 136 + }; 137 + 138 + static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0, 139 + 0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data); 140 + 141 + /* 142 + * DMA1 143 + */ 144 + 145 + static struct pl08x_channel_data s3c64xx_dma1_info[] = { 146 + { 147 + .bus_id = "pcm1_tx", 148 + .min_signal = 0, 149 + .max_signal = 0, 150 + .periph_buses = PL08X_AHB2, 151 + }, { 152 + .bus_id = "pcm1_rx", 153 + .min_signal = 1, 154 + .max_signal = 1, 155 + .periph_buses = PL08X_AHB2, 156 + }, { 157 + .bus_id = "i2s1_tx", 158 + .min_signal = 2, 159 + .max_signal = 2, 160 + .periph_buses = PL08X_AHB2, 161 + }, { 162 + .bus_id = "i2s1_rx", 163 + .min_signal = 3, 164 + .max_signal = 3, 165 + .periph_buses = PL08X_AHB2, 166 + }, { 167 + .bus_id = "spi1_tx", 168 + .min_signal = 4, 169 + .max_signal = 4, 170 + .periph_buses = PL08X_AHB2, 171 + }, { 172 + .bus_id = "spi1_rx", 173 + .min_signal = 5, 174 + .max_signal = 5, 175 + .periph_buses = PL08X_AHB2, 176 + }, { 177 + .bus_id = "ac97_out", 178 + .min_signal = 6, 179 + .max_signal = 6, 180 + .periph_buses = PL08X_AHB2, 181 + }, { 182 + .bus_id = "ac97_in", 183 + .min_signal = 7, 184 + .max_signal = 7, 185 + .periph_buses = PL08X_AHB2, 186 + }, { 187 + .bus_id = "ac97_mic", 188 + .min_signal = 8, 189 + .max_signal = 8, 190 + .periph_buses = PL08X_AHB2, 191 + }, { 192 + .bus_id = "pwm", 193 + .min_signal = 9, 194 + .max_signal = 9, 195 + .periph_buses = PL08X_AHB2, 196 + }, { 197 + .bus_id = "irda", 198 + .min_signal = 10, 199 + .max_signal = 10, 200 + .periph_buses = PL08X_AHB2, 201 + }, { 202 + .bus_id = "external", 203 + .min_signal = 11, 204 + .max_signal = 11, 205 + .periph_buses = PL08X_AHB2, 206 + }, 207 + }; 208 + 209 + struct pl08x_platform_data s3c64xx_dma1_plat_data = { 210 + .memcpy_channel = { 211 + .bus_id = "memcpy", 212 + .cctl_memcpy = 213 + (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT | 214 + PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT | 215 + PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | 216 + PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | 217 + PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | 218 + PL080_CONTROL_PROT_SYS), 219 + }, 220 + .lli_buses = PL08X_AHB1, 221 + .mem_buses = PL08X_AHB1, 222 + .get_xfer_signal = pl08x_get_xfer_signal, 223 + .put_xfer_signal = pl08x_put_xfer_signal, 224 + .slave_channels = s3c64xx_dma1_info, 225 + .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info), 226 + }; 227 + 228 + static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0, 229 + 0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data); 230 + 231 + static int __init s3c64xx_pl080_init(void) 232 + { 233 + /* Set all DMA configuration to be DMA, not SDMA */ 234 + writel(0xffffff, S3C64XX_SDMA_SEL); 235 + 236 + if (of_have_populated_dt()) 237 + return 0; 238 + 239 + amba_device_register(&s3c64xx_dma0_device, &iomem_resource); 240 + amba_device_register(&s3c64xx_dma1_device, &iomem_resource); 241 + 242 + return 0; 243 + } 244 + arch_initcall(s3c64xx_pl080_init);
+8 -2
arch/arm/plat-samsung/devs.c
··· 1468 1468 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; 1469 1469 #if defined(CONFIG_PL330_DMA) 1470 1470 pd.filter = pl330_filter; 1471 + #elif defined(CONFIG_S3C64XX_PL080) 1472 + pd.filter = pl08x_filter_id; 1471 1473 #elif defined(CONFIG_S3C24XX_DMAC) 1472 1474 pd.filter = s3c24xx_dma_filter; 1473 1475 #endif ··· 1511 1509 pd.num_cs = num_cs; 1512 1510 pd.src_clk_nr = src_clk_nr; 1513 1511 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; 1514 - #ifdef CONFIG_PL330_DMA 1512 + #if defined(CONFIG_PL330_DMA) 1515 1513 pd.filter = pl330_filter; 1514 + #elif defined(CONFIG_S3C64XX_PL080) 1515 + pd.filter = pl08x_filter_id; 1516 1516 #endif 1517 1517 1518 1518 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); ··· 1554 1550 pd.num_cs = num_cs; 1555 1551 pd.src_clk_nr = src_clk_nr; 1556 1552 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; 1557 - #ifdef CONFIG_PL330_DMA 1553 + #if defined(CONFIG_PL330_DMA) 1558 1554 pd.filter = pl330_filter; 1555 + #elif defined(CONFIG_S3C64XX_PL080) 1556 + pd.filter = pl08x_filter_id; 1559 1557 #endif 1560 1558 1561 1559 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
+7 -1
arch/arm/plat-samsung/dma-ops.c
··· 18 18 19 19 #include <mach/dma.h> 20 20 21 + #if defined(CONFIG_PL330_DMA) 22 + #define dma_filter pl330_filter 23 + #elif defined(CONFIG_S3C64XX_PL080) 24 + #define dma_filter pl08x_filter_id 25 + #endif 26 + 21 27 static unsigned samsung_dmadev_request(enum dma_ch dma_ch, 22 28 struct samsung_dma_req *param, 23 29 struct device *dev, char *ch_name) ··· 36 30 if (dev->of_node) 37 31 return (unsigned)dma_request_slave_channel(dev, ch_name); 38 32 else 39 - return (unsigned)dma_request_channel(mask, pl330_filter, 33 + return (unsigned)dma_request_channel(mask, dma_filter, 40 34 (void *)dma_ch); 41 35 } 42 36
-13
arch/arm/plat-samsung/include/plat/fiq.h
··· 1 - /* linux/arch/arm/plat-samsung/include/plat/fiq.h 2 - * 3 - * Copyright (c) 2009 Simtec Electronics 4 - * Ben Dooks <ben@simtec.co.uk> 5 - * 6 - * Header file for S3C24XX CPU FIQ support 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - extern int s3c24xx_set_fiq(unsigned int irq, bool on);
+2 -2
drivers/clk/samsung/clk-s3c64xx.c
··· 331 331 ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.0"), 332 332 ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "hsmmc"), 333 333 ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "mmc_busclk.0"), 334 - ALIAS(HCLK_DMA1, NULL, "dma1"), 335 - ALIAS(HCLK_DMA0, NULL, "dma0"), 334 + ALIAS(HCLK_DMA1, "dma-pl080s.1", "apb_pclk"), 335 + ALIAS(HCLK_DMA0, "dma-pl080s.0", "apb_pclk"), 336 336 ALIAS(HCLK_CAMIF, "s3c-camif", "camif"), 337 337 ALIAS(HCLK_LCD, "s3c-fb", "lcd"), 338 338 ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi"),
+1 -1
drivers/spi/Kconfig
··· 402 402 config SPI_S3C64XX 403 403 tristate "Samsung S3C64XX series type SPI" 404 404 depends on PLAT_SAMSUNG 405 - select S3C64XX_DMA if ARCH_S3C64XX 405 + select S3C64XX_PL080 if ARCH_S3C64XX 406 406 help 407 407 SPI driver for Samsung S3C64XX and newer SoCs. 408 408
+1 -1
drivers/spi/spi-pxa2xx.c
··· 1268 1268 dev_err(&pdev->dev, "shutdown failed with %d\n", status); 1269 1269 } 1270 1270 1271 - #ifdef CONFIG_PM 1271 + #ifdef CONFIG_PM_SLEEP 1272 1272 static int pxa2xx_spi_suspend(struct device *dev) 1273 1273 { 1274 1274 struct driver_data *drv_data = dev_get_drvdata(dev);
+13 -61
drivers/spi/spi-s3c24xx.c
··· 29 29 30 30 #include <plat/regs-spi.h> 31 31 32 - #include <plat/fiq.h> 33 32 #include <asm/fiq.h> 34 33 35 34 #include "spi-s3c24xx-fiq.h" ··· 77 78 unsigned char *rx; 78 79 79 80 struct clk *clk; 80 - struct resource *ioarea; 81 81 struct spi_master *master; 82 82 struct spi_device *curdev; 83 83 struct device *dev; 84 84 struct s3c2410_spi_info *pdata; 85 85 }; 86 - 87 86 88 87 #define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT) 89 88 #define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP) ··· 514 517 master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi)); 515 518 if (master == NULL) { 516 519 dev_err(&pdev->dev, "No memory for spi_master\n"); 517 - err = -ENOMEM; 518 - goto err_nomem; 520 + return -ENOMEM; 519 521 } 520 522 521 523 hw = spi_master_get_devdata(master); ··· 558 562 dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); 559 563 560 564 /* find and map our resources */ 561 - 562 565 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 563 - if (res == NULL) { 564 - dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); 565 - err = -ENOENT; 566 - goto err_no_iores; 567 - } 568 - 569 - hw->ioarea = request_mem_region(res->start, resource_size(res), 570 - pdev->name); 571 - 572 - if (hw->ioarea == NULL) { 573 - dev_err(&pdev->dev, "Cannot reserve region\n"); 574 - err = -ENXIO; 575 - goto err_no_iores; 576 - } 577 - 578 - hw->regs = ioremap(res->start, resource_size(res)); 579 - if (hw->regs == NULL) { 580 - dev_err(&pdev->dev, "Cannot map IO\n"); 581 - err = -ENXIO; 582 - goto err_no_iomap; 566 + hw->regs = devm_ioremap_resource(&pdev->dev, res); 567 + if (IS_ERR(hw->regs)) { 568 + err = PTR_ERR(hw->regs); 569 + goto err_no_pdata; 583 570 } 584 571 585 572 hw->irq = platform_get_irq(pdev, 0); 586 573 if (hw->irq < 0) { 587 574 dev_err(&pdev->dev, "No IRQ specified\n"); 588 575 err = -ENOENT; 589 - goto err_no_irq; 576 + goto err_no_pdata; 590 577 } 591 578 592 - err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw); 579 + err = devm_request_irq(&pdev->dev, hw->irq, s3c24xx_spi_irq, 0, 580 + pdev->name, hw); 593 581 if (err) { 594 582 dev_err(&pdev->dev, "Cannot claim IRQ\n"); 595 - goto err_no_irq; 583 + goto err_no_pdata; 596 584 } 597 585 598 - hw->clk = clk_get(&pdev->dev, "spi"); 586 + hw->clk = devm_clk_get(&pdev->dev, "spi"); 599 587 if (IS_ERR(hw->clk)) { 600 588 dev_err(&pdev->dev, "No clock for device\n"); 601 589 err = PTR_ERR(hw->clk); 602 - goto err_no_clk; 590 + goto err_no_pdata; 603 591 } 604 592 605 593 /* setup any gpio we can */ ··· 595 615 goto err_register; 596 616 } 597 617 598 - err = gpio_request(pdata->pin_cs, dev_name(&pdev->dev)); 618 + err = devm_gpio_request(&pdev->dev, pdata->pin_cs, 619 + dev_name(&pdev->dev)); 599 620 if (err) { 600 621 dev_err(&pdev->dev, "Failed to get gpio for cs\n"); 601 622 goto err_register; ··· 620 639 return 0; 621 640 622 641 err_register: 623 - if (hw->set_cs == s3c24xx_spi_gpiocs) 624 - gpio_free(pdata->pin_cs); 625 - 626 642 clk_disable(hw->clk); 627 - clk_put(hw->clk); 628 643 629 - err_no_clk: 630 - free_irq(hw->irq, hw); 631 - 632 - err_no_irq: 633 - iounmap(hw->regs); 634 - 635 - err_no_iomap: 636 - release_resource(hw->ioarea); 637 - kfree(hw->ioarea); 638 - 639 - err_no_iores: 640 644 err_no_pdata: 641 645 spi_master_put(hw->master); 642 - 643 - err_nomem: 644 646 return err; 645 647 } 646 648 ··· 632 668 struct s3c24xx_spi *hw = platform_get_drvdata(dev); 633 669 634 670 spi_bitbang_stop(&hw->bitbang); 635 - 636 671 clk_disable(hw->clk); 637 - clk_put(hw->clk); 638 - 639 - free_irq(hw->irq, hw); 640 - iounmap(hw->regs); 641 - 642 - if (hw->set_cs == s3c24xx_spi_gpiocs) 643 - gpio_free(hw->pdata->pin_cs); 644 - 645 - release_resource(hw->ioarea); 646 - kfree(hw->ioarea); 647 - 648 672 spi_master_put(hw->master); 649 673 return 0; 650 674 }
+1 -4
drivers/spi/spi-s3c64xx.c
··· 890 890 unsigned long flags; 891 891 int use_dma; 892 892 893 - reinit_completion(&sdd->xfer_completion); 893 + reinit_completion(&sdd->xfer_completion); 894 894 895 895 /* Only BPW and Speed may change across transfers */ 896 896 bpw = xfer->bits_per_word; ··· 923 923 sdd->state &= ~TXBUSY; 924 924 925 925 enable_datapath(sdd, spi, xfer, use_dma); 926 - 927 - /* Start the signals */ 928 - writel(0, sdd->regs + S3C64XX_SPI_SLAVE_SEL); 929 926 930 927 /* Start the signals */ 931 928 writel(0, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
+2 -8
drivers/spi/spi-sh.c
··· 171 171 int remain = t->len; 172 172 int cur_len; 173 173 unsigned char *data; 174 - unsigned long tmp; 175 174 long ret; 176 175 177 176 if (t->len) ··· 212 213 } 213 214 214 215 if (list_is_last(&t->transfer_list, &mesg->transfers)) { 215 - tmp = spi_sh_read(ss, SPI_SH_CR1); 216 - tmp = tmp & ~(SPI_SH_SSD | SPI_SH_SSDB); 217 - spi_sh_write(ss, tmp, SPI_SH_CR1); 216 + spi_sh_clear_bit(ss, SPI_SH_SSD | SPI_SH_SSDB, SPI_SH_CR1); 218 217 spi_sh_set_bit(ss, SPI_SH_SSA, SPI_SH_CR1); 219 218 220 219 ss->cr1 &= ~SPI_SH_TBE; ··· 236 239 int remain = t->len; 237 240 int cur_len; 238 241 unsigned char *data; 239 - unsigned long tmp; 240 242 long ret; 241 243 242 244 if (t->len > SPI_SH_MAX_BYTE) ··· 243 247 else 244 248 spi_sh_write(ss, t->len, SPI_SH_CR3); 245 249 246 - tmp = spi_sh_read(ss, SPI_SH_CR1); 247 - tmp = tmp & ~(SPI_SH_SSD | SPI_SH_SSDB); 248 - spi_sh_write(ss, tmp, SPI_SH_CR1); 250 + spi_sh_clear_bit(ss, SPI_SH_SSD | SPI_SH_SSDB, SPI_SH_CR1); 249 251 spi_sh_set_bit(ss, SPI_SH_SSA, SPI_SH_CR1); 250 252 251 253 spi_sh_wait_write_buffer_empty(ss);
+34 -64
drivers/spi/spi-tegra114.c
··· 54 54 #define SPI_CS_SS_VAL (1 << 20) 55 55 #define SPI_CS_SW_HW (1 << 21) 56 56 /* SPI_CS_POL_INACTIVE bits are default high */ 57 - #define SPI_CS_POL_INACTIVE 22 58 - #define SPI_CS_POL_INACTIVE_0 (1 << 22) 59 - #define SPI_CS_POL_INACTIVE_1 (1 << 23) 60 - #define SPI_CS_POL_INACTIVE_2 (1 << 24) 61 - #define SPI_CS_POL_INACTIVE_3 (1 << 25) 57 + /* n from 0 to 3 */ 58 + #define SPI_CS_POL_INACTIVE(n) (1 << (22 + (n))) 62 59 #define SPI_CS_POL_INACTIVE_MASK (0xF << 22) 63 60 64 61 #define SPI_CS_SEL_0 (0 << 26) ··· 162 165 #define MAX_HOLD_CYCLES 16 163 166 #define SPI_DEFAULT_SPEED 25000000 164 167 165 - #define MAX_CHIP_SELECT 4 166 - #define SPI_FIFO_DEPTH 64 167 - 168 168 struct tegra_spi_data { 169 169 struct device *dev; 170 170 struct spi_master *master; ··· 178 184 struct spi_device *cur_spi; 179 185 struct spi_device *cs_control; 180 186 unsigned cur_pos; 181 - unsigned cur_len; 182 187 unsigned words_per_32bit; 183 188 unsigned bytes_per_word; 184 189 unsigned curr_dma_words; ··· 197 204 u32 rx_status; 198 205 u32 status_reg; 199 206 bool is_packed; 200 - unsigned long packed_size; 201 207 202 208 u32 command1_reg; 203 209 u32 dma_control_reg; 204 210 u32 def_command1_reg; 205 - u32 spi_cs_timing; 206 211 207 212 struct completion xfer_completion; 208 213 struct spi_transfer *curr_xfer; ··· 218 227 static int tegra_spi_runtime_suspend(struct device *dev); 219 228 static int tegra_spi_runtime_resume(struct device *dev); 220 229 221 - static inline unsigned long tegra_spi_readl(struct tegra_spi_data *tspi, 230 + static inline u32 tegra_spi_readl(struct tegra_spi_data *tspi, 222 231 unsigned long reg) 223 232 { 224 233 return readl(tspi->base + reg); 225 234 } 226 235 227 236 static inline void tegra_spi_writel(struct tegra_spi_data *tspi, 228 - unsigned long val, unsigned long reg) 237 + u32 val, unsigned long reg) 229 238 { 230 239 writel(val, tspi->base + reg); 231 240 ··· 236 245 237 246 static void tegra_spi_clear_status(struct tegra_spi_data *tspi) 238 247 { 239 - unsigned long val; 248 + u32 val; 240 249 241 250 /* Write 1 to clear status register */ 242 251 val = tegra_spi_readl(tspi, SPI_TRANS_STATUS); ··· 287 296 { 288 297 unsigned nbytes; 289 298 unsigned tx_empty_count; 290 - unsigned long fifo_status; 299 + u32 fifo_status; 291 300 unsigned max_n_32bit; 292 301 unsigned i, count; 293 - unsigned long x; 294 302 unsigned int written_words; 295 303 unsigned fifo_words_left; 296 304 u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos; ··· 303 313 nbytes = written_words * tspi->bytes_per_word; 304 314 max_n_32bit = DIV_ROUND_UP(nbytes, 4); 305 315 for (count = 0; count < max_n_32bit; count++) { 306 - x = 0; 316 + u32 x = 0; 307 317 for (i = 0; (i < 4) && nbytes; i++, nbytes--) 308 - x |= (*tx_buf++) << (i*8); 318 + x |= (u32)(*tx_buf++) << (i * 8); 309 319 tegra_spi_writel(tspi, x, SPI_TX_FIFO); 310 320 } 311 321 } else { ··· 313 323 written_words = max_n_32bit; 314 324 nbytes = written_words * tspi->bytes_per_word; 315 325 for (count = 0; count < max_n_32bit; count++) { 316 - x = 0; 326 + u32 x = 0; 317 327 for (i = 0; nbytes && (i < tspi->bytes_per_word); 318 328 i++, nbytes--) 319 - x |= ((*tx_buf++) << i*8); 329 + x |= (u32)(*tx_buf++) << (i * 8); 320 330 tegra_spi_writel(tspi, x, SPI_TX_FIFO); 321 331 } 322 332 } ··· 328 338 struct tegra_spi_data *tspi, struct spi_transfer *t) 329 339 { 330 340 unsigned rx_full_count; 331 - unsigned long fifo_status; 341 + u32 fifo_status; 332 342 unsigned i, count; 333 - unsigned long x; 334 343 unsigned int read_words = 0; 335 344 unsigned len; 336 345 u8 *rx_buf = (u8 *)t->rx_buf + tspi->cur_rx_pos; ··· 339 350 if (tspi->is_packed) { 340 351 len = tspi->curr_dma_words * tspi->bytes_per_word; 341 352 for (count = 0; count < rx_full_count; count++) { 342 - x = tegra_spi_readl(tspi, SPI_RX_FIFO); 353 + u32 x = tegra_spi_readl(tspi, SPI_RX_FIFO); 343 354 for (i = 0; len && (i < 4); i++, len--) 344 355 *rx_buf++ = (x >> i*8) & 0xFF; 345 356 } 346 357 tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; 347 358 read_words += tspi->curr_dma_words; 348 359 } else { 349 - unsigned int rx_mask; 350 - unsigned int bits_per_word = t->bits_per_word; 351 - 352 - rx_mask = (1 << bits_per_word) - 1; 360 + u32 rx_mask = ((u32)1 << t->bits_per_word) - 1; 353 361 for (count = 0; count < rx_full_count; count++) { 354 - x = tegra_spi_readl(tspi, SPI_RX_FIFO); 355 - x &= rx_mask; 362 + u32 x = tegra_spi_readl(tspi, SPI_RX_FIFO) & rx_mask; 356 363 for (i = 0; (i < tspi->bytes_per_word); i++) 357 364 *rx_buf++ = (x >> (i*8)) & 0xFF; 358 365 } ··· 361 376 static void tegra_spi_copy_client_txbuf_to_spi_txbuf( 362 377 struct tegra_spi_data *tspi, struct spi_transfer *t) 363 378 { 364 - unsigned len; 365 - 366 379 /* Make the dma buffer to read by cpu */ 367 380 dma_sync_single_for_cpu(tspi->dev, tspi->tx_dma_phys, 368 381 tspi->dma_buf_size, DMA_TO_DEVICE); 369 382 370 383 if (tspi->is_packed) { 371 - len = tspi->curr_dma_words * tspi->bytes_per_word; 384 + unsigned len = tspi->curr_dma_words * tspi->bytes_per_word; 372 385 memcpy(tspi->tx_dma_buf, t->tx_buf + tspi->cur_pos, len); 373 386 } else { 374 387 unsigned int i; 375 388 unsigned int count; 376 389 u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos; 377 390 unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; 378 - unsigned int x; 379 391 380 392 for (count = 0; count < tspi->curr_dma_words; count++) { 381 - x = 0; 393 + u32 x = 0; 382 394 for (i = 0; consume && (i < tspi->bytes_per_word); 383 395 i++, consume--) 384 - x |= ((*tx_buf++) << i * 8); 396 + x |= (u32)(*tx_buf++) << (i * 8); 385 397 tspi->tx_dma_buf[count] = x; 386 398 } 387 399 } ··· 392 410 static void tegra_spi_copy_spi_rxbuf_to_client_rxbuf( 393 411 struct tegra_spi_data *tspi, struct spi_transfer *t) 394 412 { 395 - unsigned len; 396 - 397 413 /* Make the dma buffer to read by cpu */ 398 414 dma_sync_single_for_cpu(tspi->dev, tspi->rx_dma_phys, 399 415 tspi->dma_buf_size, DMA_FROM_DEVICE); 400 416 401 417 if (tspi->is_packed) { 402 - len = tspi->curr_dma_words * tspi->bytes_per_word; 418 + unsigned len = tspi->curr_dma_words * tspi->bytes_per_word; 403 419 memcpy(t->rx_buf + tspi->cur_rx_pos, tspi->rx_dma_buf, len); 404 420 } else { 405 421 unsigned int i; 406 422 unsigned int count; 407 423 unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos; 408 - unsigned int x; 409 - unsigned int rx_mask; 410 - unsigned int bits_per_word = t->bits_per_word; 424 + u32 rx_mask = ((u32)1 << t->bits_per_word) - 1; 411 425 412 - rx_mask = (1 << bits_per_word) - 1; 413 426 for (count = 0; count < tspi->curr_dma_words; count++) { 414 - x = tspi->rx_dma_buf[count]; 415 - x &= rx_mask; 427 + u32 x = tspi->rx_dma_buf[count] & rx_mask; 416 428 for (i = 0; (i < tspi->bytes_per_word); i++) 417 429 *rx_buf++ = (x >> (i*8)) & 0xFF; 418 430 } ··· 466 490 static int tegra_spi_start_dma_based_transfer( 467 491 struct tegra_spi_data *tspi, struct spi_transfer *t) 468 492 { 469 - unsigned long val; 493 + u32 val; 470 494 unsigned int len; 471 495 int ret = 0; 472 - unsigned long status; 496 + u32 status; 473 497 474 498 /* Make sure that Rx and Tx fifo are empty */ 475 499 status = tegra_spi_readl(tspi, SPI_FIFO_STATUS); 476 500 if ((status & SPI_FIFO_EMPTY) != SPI_FIFO_EMPTY) { 477 - dev_err(tspi->dev, 478 - "Rx/Tx fifo are not empty status 0x%08lx\n", status); 501 + dev_err(tspi->dev, "Rx/Tx fifo are not empty status 0x%08x\n", 502 + (unsigned)status); 479 503 return -EIO; 480 504 } 481 505 ··· 540 564 static int tegra_spi_start_cpu_based_transfer( 541 565 struct tegra_spi_data *tspi, struct spi_transfer *t) 542 566 { 543 - unsigned long val; 567 + u32 val; 544 568 unsigned cur_words; 545 569 546 570 if (tspi->cur_direction & DATA_DIR_TX) ··· 653 677 dma_release_channel(dma_chan); 654 678 } 655 679 656 - static unsigned long tegra_spi_setup_transfer_one(struct spi_device *spi, 680 + static u32 tegra_spi_setup_transfer_one(struct spi_device *spi, 657 681 struct spi_transfer *t, bool is_first_of_msg) 658 682 { 659 683 struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master); 660 684 u32 speed = t->speed_hz; 661 685 u8 bits_per_word = t->bits_per_word; 662 - unsigned long command1; 686 + u32 command1; 663 687 int req_mode; 664 688 665 689 if (speed != tspi->cur_speed) { ··· 714 738 } 715 739 716 740 static int tegra_spi_start_transfer_one(struct spi_device *spi, 717 - struct spi_transfer *t, unsigned long command1) 741 + struct spi_transfer *t, u32 command1) 718 742 { 719 743 struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master); 720 744 unsigned total_fifo_words; ··· 739 763 tegra_spi_writel(tspi, command1, SPI_COMMAND1); 740 764 tspi->command1_reg = command1; 741 765 742 - dev_dbg(tspi->dev, "The def 0x%x and written 0x%lx\n", 743 - tspi->def_command1_reg, command1); 766 + dev_dbg(tspi->dev, "The def 0x%x and written 0x%x\n", 767 + tspi->def_command1_reg, (unsigned)command1); 744 768 745 769 if (total_fifo_words > SPI_FIFO_DEPTH) 746 770 ret = tegra_spi_start_dma_based_transfer(tspi, t); ··· 752 776 static int tegra_spi_setup(struct spi_device *spi) 753 777 { 754 778 struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master); 755 - unsigned long val; 779 + u32 val; 756 780 unsigned long flags; 757 781 int ret; 758 - unsigned int cs_pol_bit[MAX_CHIP_SELECT] = { 759 - SPI_CS_POL_INACTIVE_0, 760 - SPI_CS_POL_INACTIVE_1, 761 - SPI_CS_POL_INACTIVE_2, 762 - SPI_CS_POL_INACTIVE_3, 763 - }; 764 782 765 783 dev_dbg(&spi->dev, "setup %d bpw, %scpol, %scpha, %dHz\n", 766 784 spi->bits_per_word, ··· 776 806 spin_lock_irqsave(&tspi->lock, flags); 777 807 val = tspi->def_command1_reg; 778 808 if (spi->mode & SPI_CS_HIGH) 779 - val &= ~cs_pol_bit[spi->chip_select]; 809 + val &= ~SPI_CS_POL_INACTIVE(spi->chip_select); 780 810 else 781 - val |= cs_pol_bit[spi->chip_select]; 811 + val |= SPI_CS_POL_INACTIVE(spi->chip_select); 782 812 tspi->def_command1_reg = val; 783 813 tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1); 784 814 spin_unlock_irqrestore(&tspi->lock, flags); ··· 812 842 msg->actual_length = 0; 813 843 814 844 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 815 - unsigned long cmd1; 845 + u32 cmd1; 816 846 817 847 reinit_completion(&tspi->xfer_completion); 818 848
+10 -12
drivers/spi/spi-tegra20-sflash.c
··· 148 148 static int tegra_sflash_runtime_suspend(struct device *dev); 149 149 static int tegra_sflash_runtime_resume(struct device *dev); 150 150 151 - static inline unsigned long tegra_sflash_readl(struct tegra_sflash_data *tsd, 151 + static inline u32 tegra_sflash_readl(struct tegra_sflash_data *tsd, 152 152 unsigned long reg) 153 153 { 154 154 return readl(tsd->base + reg); 155 155 } 156 156 157 157 static inline void tegra_sflash_writel(struct tegra_sflash_data *tsd, 158 - unsigned long val, unsigned long reg) 158 + u32 val, unsigned long reg) 159 159 { 160 160 writel(val, tsd->base + reg); 161 161 } ··· 185 185 struct tegra_sflash_data *tsd, struct spi_transfer *t) 186 186 { 187 187 unsigned nbytes; 188 - unsigned long status; 188 + u32 status; 189 189 unsigned max_n_32bit = tsd->curr_xfer_words; 190 190 u8 *tx_buf = (u8 *)t->tx_buf + tsd->cur_tx_pos; 191 191 ··· 196 196 status = tegra_sflash_readl(tsd, SPI_STATUS); 197 197 while (!(status & SPI_TXF_FULL)) { 198 198 int i; 199 - unsigned int x = 0; 199 + u32 x = 0; 200 200 201 201 for (i = 0; nbytes && (i < tsd->bytes_per_word); 202 202 i++, nbytes--) 203 - x |= ((*tx_buf++) << i*8); 203 + x |= (u32)(*tx_buf++) << (i * 8); 204 204 tegra_sflash_writel(tsd, x, SPI_TX_FIFO); 205 205 if (!nbytes) 206 206 break; ··· 214 214 static int tegra_sflash_read_rx_fifo_to_client_rxbuf( 215 215 struct tegra_sflash_data *tsd, struct spi_transfer *t) 216 216 { 217 - unsigned long status; 217 + u32 status; 218 218 unsigned int read_words = 0; 219 219 u8 *rx_buf = (u8 *)t->rx_buf + tsd->cur_rx_pos; 220 220 221 221 status = tegra_sflash_readl(tsd, SPI_STATUS); 222 222 while (!(status & SPI_RXF_EMPTY)) { 223 223 int i; 224 - unsigned long x; 225 - 226 - x = tegra_sflash_readl(tsd, SPI_RX_FIFO); 224 + u32 x = tegra_sflash_readl(tsd, SPI_RX_FIFO); 227 225 for (i = 0; (i < tsd->bytes_per_word); i++) 228 226 *rx_buf++ = (x >> (i*8)) & 0xFF; 229 227 read_words++; ··· 234 236 static int tegra_sflash_start_cpu_based_transfer( 235 237 struct tegra_sflash_data *tsd, struct spi_transfer *t) 236 238 { 237 - unsigned long val = 0; 239 + u32 val = 0; 238 240 unsigned cur_words; 239 241 240 242 if (tsd->cur_direction & DATA_DIR_TX) ··· 264 266 { 265 267 struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); 266 268 u32 speed; 267 - unsigned long command; 269 + u32 command; 268 270 269 271 speed = t->speed_hz; 270 272 if (speed != tsd->cur_speed) { ··· 311 313 tegra_sflash_writel(tsd, command, SPI_COMMAND); 312 314 tsd->command_reg = command; 313 315 314 - return tegra_sflash_start_cpu_based_transfer(tsd, t); 316 + return tegra_sflash_start_cpu_based_transfer(tsd, t); 315 317 } 316 318 317 319 static int tegra_sflash_setup(struct spi_device *spi)
+40 -57
drivers/spi/spi-tegra20-slink.c
··· 196 196 u32 rx_status; 197 197 u32 status_reg; 198 198 bool is_packed; 199 - unsigned long packed_size; 199 + u32 packed_size; 200 200 201 201 u32 command_reg; 202 202 u32 command2_reg; ··· 220 220 static int tegra_slink_runtime_suspend(struct device *dev); 221 221 static int tegra_slink_runtime_resume(struct device *dev); 222 222 223 - static inline unsigned long tegra_slink_readl(struct tegra_slink_data *tspi, 223 + static inline u32 tegra_slink_readl(struct tegra_slink_data *tspi, 224 224 unsigned long reg) 225 225 { 226 226 return readl(tspi->base + reg); 227 227 } 228 228 229 229 static inline void tegra_slink_writel(struct tegra_slink_data *tspi, 230 - unsigned long val, unsigned long reg) 230 + u32 val, unsigned long reg) 231 231 { 232 232 writel(val, tspi->base + reg); 233 233 ··· 238 238 239 239 static void tegra_slink_clear_status(struct tegra_slink_data *tspi) 240 240 { 241 - unsigned long val; 242 - unsigned long val_write = 0; 241 + u32 val_write; 243 242 244 - val = tegra_slink_readl(tspi, SLINK_STATUS); 243 + tegra_slink_readl(tspi, SLINK_STATUS); 245 244 246 245 /* Write 1 to clear status register */ 247 246 val_write = SLINK_RDY | SLINK_FIFO_ERROR; 248 247 tegra_slink_writel(tspi, val_write, SLINK_STATUS); 249 248 } 250 249 251 - static unsigned long tegra_slink_get_packed_size(struct tegra_slink_data *tspi, 250 + static u32 tegra_slink_get_packed_size(struct tegra_slink_data *tspi, 252 251 struct spi_transfer *t) 253 252 { 254 - unsigned long val; 255 - 256 253 switch (tspi->bytes_per_word) { 257 254 case 0: 258 - val = SLINK_PACK_SIZE_4; 259 - break; 255 + return SLINK_PACK_SIZE_4; 260 256 case 1: 261 - val = SLINK_PACK_SIZE_8; 262 - break; 257 + return SLINK_PACK_SIZE_8; 263 258 case 2: 264 - val = SLINK_PACK_SIZE_16; 265 - break; 259 + return SLINK_PACK_SIZE_16; 266 260 case 4: 267 - val = SLINK_PACK_SIZE_32; 268 - break; 261 + return SLINK_PACK_SIZE_32; 269 262 default: 270 - val = 0; 263 + return 0; 271 264 } 272 - return val; 273 265 } 274 266 275 267 static unsigned tegra_slink_calculate_curr_xfer_param( ··· 304 312 { 305 313 unsigned nbytes; 306 314 unsigned tx_empty_count; 307 - unsigned long fifo_status; 315 + u32 fifo_status; 308 316 unsigned max_n_32bit; 309 317 unsigned i, count; 310 - unsigned long x; 311 318 unsigned int written_words; 312 319 unsigned fifo_words_left; 313 320 u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos; ··· 320 329 nbytes = written_words * tspi->bytes_per_word; 321 330 max_n_32bit = DIV_ROUND_UP(nbytes, 4); 322 331 for (count = 0; count < max_n_32bit; count++) { 323 - x = 0; 332 + u32 x = 0; 324 333 for (i = 0; (i < 4) && nbytes; i++, nbytes--) 325 - x |= (*tx_buf++) << (i*8); 334 + x |= (u32)(*tx_buf++) << (i * 8); 326 335 tegra_slink_writel(tspi, x, SLINK_TX_FIFO); 327 336 } 328 337 } else { ··· 330 339 written_words = max_n_32bit; 331 340 nbytes = written_words * tspi->bytes_per_word; 332 341 for (count = 0; count < max_n_32bit; count++) { 333 - x = 0; 342 + u32 x = 0; 334 343 for (i = 0; nbytes && (i < tspi->bytes_per_word); 335 344 i++, nbytes--) 336 - x |= ((*tx_buf++) << i*8); 345 + x |= (u32)(*tx_buf++) << (i * 8); 337 346 tegra_slink_writel(tspi, x, SLINK_TX_FIFO); 338 347 } 339 348 } ··· 345 354 struct tegra_slink_data *tspi, struct spi_transfer *t) 346 355 { 347 356 unsigned rx_full_count; 348 - unsigned long fifo_status; 357 + u32 fifo_status; 349 358 unsigned i, count; 350 - unsigned long x; 351 359 unsigned int read_words = 0; 352 360 unsigned len; 353 361 u8 *rx_buf = (u8 *)t->rx_buf + tspi->cur_rx_pos; ··· 356 366 if (tspi->is_packed) { 357 367 len = tspi->curr_dma_words * tspi->bytes_per_word; 358 368 for (count = 0; count < rx_full_count; count++) { 359 - x = tegra_slink_readl(tspi, SLINK_RX_FIFO); 369 + u32 x = tegra_slink_readl(tspi, SLINK_RX_FIFO); 360 370 for (i = 0; len && (i < 4); i++, len--) 361 371 *rx_buf++ = (x >> i*8) & 0xFF; 362 372 } ··· 364 374 read_words += tspi->curr_dma_words; 365 375 } else { 366 376 for (count = 0; count < rx_full_count; count++) { 367 - x = tegra_slink_readl(tspi, SLINK_RX_FIFO); 377 + u32 x = tegra_slink_readl(tspi, SLINK_RX_FIFO); 368 378 for (i = 0; (i < tspi->bytes_per_word); i++) 369 379 *rx_buf++ = (x >> (i*8)) & 0xFF; 370 380 } ··· 377 387 static void tegra_slink_copy_client_txbuf_to_spi_txbuf( 378 388 struct tegra_slink_data *tspi, struct spi_transfer *t) 379 389 { 380 - unsigned len; 381 - 382 390 /* Make the dma buffer to read by cpu */ 383 391 dma_sync_single_for_cpu(tspi->dev, tspi->tx_dma_phys, 384 392 tspi->dma_buf_size, DMA_TO_DEVICE); 385 393 386 394 if (tspi->is_packed) { 387 - len = tspi->curr_dma_words * tspi->bytes_per_word; 395 + unsigned len = tspi->curr_dma_words * tspi->bytes_per_word; 388 396 memcpy(tspi->tx_dma_buf, t->tx_buf + tspi->cur_pos, len); 389 397 } else { 390 398 unsigned int i; 391 399 unsigned int count; 392 400 u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos; 393 401 unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; 394 - unsigned int x; 395 402 396 403 for (count = 0; count < tspi->curr_dma_words; count++) { 397 - x = 0; 404 + u32 x = 0; 398 405 for (i = 0; consume && (i < tspi->bytes_per_word); 399 406 i++, consume--) 400 - x |= ((*tx_buf++) << i * 8); 407 + x |= (u32)(*tx_buf++) << (i * 8); 401 408 tspi->tx_dma_buf[count] = x; 402 409 } 403 410 } ··· 421 434 unsigned int i; 422 435 unsigned int count; 423 436 unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos; 424 - unsigned int x; 425 - unsigned int rx_mask, bits_per_word; 437 + u32 rx_mask = ((u32)1 << t->bits_per_word) - 1; 426 438 427 - bits_per_word = t->bits_per_word; 428 - rx_mask = (1 << bits_per_word) - 1; 429 439 for (count = 0; count < tspi->curr_dma_words; count++) { 430 - x = tspi->rx_dma_buf[count]; 431 - x &= rx_mask; 440 + u32 x = tspi->rx_dma_buf[count] & rx_mask; 432 441 for (i = 0; (i < tspi->bytes_per_word); i++) 433 442 *rx_buf++ = (x >> (i*8)) & 0xFF; 434 443 } ··· 484 501 static int tegra_slink_start_dma_based_transfer( 485 502 struct tegra_slink_data *tspi, struct spi_transfer *t) 486 503 { 487 - unsigned long val; 488 - unsigned long test_val; 504 + u32 val; 489 505 unsigned int len; 490 506 int ret = 0; 491 - unsigned long status; 507 + u32 status; 492 508 493 509 /* Make sure that Rx and Tx fifo are empty */ 494 510 status = tegra_slink_readl(tspi, SLINK_STATUS); 495 511 if ((status & SLINK_FIFO_EMPTY) != SLINK_FIFO_EMPTY) { 496 - dev_err(tspi->dev, 497 - "Rx/Tx fifo are not empty status 0x%08lx\n", status); 512 + dev_err(tspi->dev, "Rx/Tx fifo are not empty status 0x%08x\n", 513 + (unsigned)status); 498 514 return -EIO; 499 515 } 500 516 ··· 533 551 } 534 552 535 553 /* Wait for tx fifo to be fill before starting slink */ 536 - test_val = tegra_slink_readl(tspi, SLINK_STATUS); 537 - while (!(test_val & SLINK_TX_FULL)) 538 - test_val = tegra_slink_readl(tspi, SLINK_STATUS); 554 + status = tegra_slink_readl(tspi, SLINK_STATUS); 555 + while (!(status & SLINK_TX_FULL)) 556 + status = tegra_slink_readl(tspi, SLINK_STATUS); 539 557 } 540 558 541 559 if (tspi->cur_direction & DATA_DIR_RX) { ··· 569 587 static int tegra_slink_start_cpu_based_transfer( 570 588 struct tegra_slink_data *tspi, struct spi_transfer *t) 571 589 { 572 - unsigned long val; 590 + u32 val; 573 591 unsigned cur_words; 574 592 575 593 val = tspi->packed_size; ··· 696 714 u8 bits_per_word; 697 715 unsigned total_fifo_words; 698 716 int ret; 699 - unsigned long command; 700 - unsigned long command2; 717 + u32 command; 718 + u32 command2; 701 719 702 720 bits_per_word = t->bits_per_word; 703 721 speed = t->speed_hz; ··· 744 762 745 763 static int tegra_slink_setup(struct spi_device *spi) 746 764 { 747 - struct tegra_slink_data *tspi = spi_master_get_devdata(spi->master); 748 - unsigned long val; 749 - unsigned long flags; 750 - int ret; 751 - unsigned int cs_pol_bit[MAX_CHIP_SELECT] = { 765 + static const u32 cs_pol_bit[MAX_CHIP_SELECT] = { 752 766 SLINK_CS_POLARITY, 753 767 SLINK_CS_POLARITY1, 754 768 SLINK_CS_POLARITY2, 755 769 SLINK_CS_POLARITY3, 756 770 }; 771 + 772 + struct tegra_slink_data *tspi = spi_master_get_devdata(spi->master); 773 + u32 val; 774 + unsigned long flags; 775 + int ret; 757 776 758 777 dev_dbg(&spi->dev, "setup %d bpw, %scpol, %scpha, %dHz\n", 759 778 spi->bits_per_word,
+73 -44
drivers/spi/spi-ti-qspi.c
··· 46 46 47 47 struct spi_master *master; 48 48 void __iomem *base; 49 + void __iomem *ctrl_base; 50 + void __iomem *mmap_base; 49 51 struct clk *fclk; 50 52 struct device *dev; 51 53 ··· 56 54 u32 spi_max_frequency; 57 55 u32 cmd; 58 56 u32 dc; 57 + 58 + bool ctrl_mod; 59 59 }; 60 60 61 61 #define QSPI_PID (0x0) ··· 208 204 txbuf = t->tx_buf; 209 205 cmd = qspi->cmd | QSPI_WR_SNGL; 210 206 count = t->len; 211 - wlen = t->bits_per_word; 207 + wlen = t->bits_per_word >> 3; /* in bytes */ 212 208 213 209 while (count) { 214 210 switch (wlen) { 215 - case 8: 211 + case 1: 216 212 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %02x\n", 217 213 cmd, qspi->dc, *txbuf); 218 214 writeb(*txbuf, qspi->base + QSPI_SPI_DATA_REG); 219 - ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 220 - ret = wait_for_completion_timeout(&qspi->transfer_complete, 221 - QSPI_COMPLETION_TIMEOUT); 222 - if (ret == 0) { 223 - dev_err(qspi->dev, "write timed out\n"); 224 - return -ETIMEDOUT; 225 - } 226 - txbuf += 1; 227 - count -= 1; 228 215 break; 229 - case 16: 216 + case 2: 230 217 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %04x\n", 231 218 cmd, qspi->dc, *txbuf); 232 219 writew(*((u16 *)txbuf), qspi->base + QSPI_SPI_DATA_REG); 233 - ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 234 - ret = wait_for_completion_timeout(&qspi->transfer_complete, 235 - QSPI_COMPLETION_TIMEOUT); 236 - if (ret == 0) { 237 - dev_err(qspi->dev, "write timed out\n"); 238 - return -ETIMEDOUT; 239 - } 240 - txbuf += 2; 241 - count -= 2; 242 220 break; 243 - case 32: 221 + case 4: 244 222 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %08x\n", 245 223 cmd, qspi->dc, *txbuf); 246 224 writel(*((u32 *)txbuf), qspi->base + QSPI_SPI_DATA_REG); 247 - ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 248 - ret = wait_for_completion_timeout(&qspi->transfer_complete, 249 - QSPI_COMPLETION_TIMEOUT); 250 - if (ret == 0) { 251 - dev_err(qspi->dev, "write timed out\n"); 252 - return -ETIMEDOUT; 253 - } 254 - txbuf += 4; 255 - count -= 4; 256 225 break; 257 226 } 227 + 228 + ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 229 + ret = wait_for_completion_timeout(&qspi->transfer_complete, 230 + QSPI_COMPLETION_TIMEOUT); 231 + if (ret == 0) { 232 + dev_err(qspi->dev, "write timed out\n"); 233 + return -ETIMEDOUT; 234 + } 235 + txbuf += wlen; 236 + count -= wlen; 258 237 } 259 238 260 239 return 0; ··· 263 276 break; 264 277 } 265 278 count = t->len; 266 - wlen = t->bits_per_word; 279 + wlen = t->bits_per_word >> 3; /* in bytes */ 267 280 268 281 while (count) { 269 282 dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n", cmd, qspi->dc); ··· 275 288 return -ETIMEDOUT; 276 289 } 277 290 switch (wlen) { 278 - case 8: 291 + case 1: 279 292 *rxbuf = readb(qspi->base + QSPI_SPI_DATA_REG); 280 - rxbuf += 1; 281 - count -= 1; 282 293 break; 283 - case 16: 294 + case 2: 284 295 *((u16 *)rxbuf) = readw(qspi->base + QSPI_SPI_DATA_REG); 285 - rxbuf += 2; 286 - count -= 2; 287 296 break; 288 - case 32: 297 + case 4: 289 298 *((u32 *)rxbuf) = readl(qspi->base + QSPI_SPI_DATA_REG); 290 - rxbuf += 4; 291 - count -= 4; 292 299 break; 293 300 } 301 + rxbuf += wlen; 302 + count -= wlen; 294 303 } 295 304 296 305 return 0; ··· 418 435 { 419 436 struct ti_qspi *qspi; 420 437 struct spi_master *master; 421 - struct resource *r; 438 + struct resource *r, *res_ctrl, *res_mmap; 422 439 struct device_node *np = pdev->dev.of_node; 423 440 u32 max_freq; 424 441 int ret = 0, num_cs, irq; ··· 445 462 qspi->dev = &pdev->dev; 446 463 platform_set_drvdata(pdev, qspi); 447 464 448 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 465 + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_base"); 466 + if (r == NULL) { 467 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 468 + if (r == NULL) { 469 + dev_err(&pdev->dev, "missing platform data\n"); 470 + return -ENODEV; 471 + } 472 + } 473 + 474 + res_mmap = platform_get_resource_byname(pdev, 475 + IORESOURCE_MEM, "qspi_mmap"); 476 + if (res_mmap == NULL) { 477 + res_mmap = platform_get_resource(pdev, IORESOURCE_MEM, 1); 478 + if (res_mmap == NULL) { 479 + dev_err(&pdev->dev, 480 + "memory mapped resource not required\n"); 481 + return -ENODEV; 482 + } 483 + } 484 + 485 + res_ctrl = platform_get_resource_byname(pdev, 486 + IORESOURCE_MEM, "qspi_ctrlmod"); 487 + if (res_ctrl == NULL) { 488 + res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 2); 489 + if (res_ctrl == NULL) { 490 + dev_dbg(&pdev->dev, 491 + "control module resources not required\n"); 492 + } 493 + } 449 494 450 495 irq = platform_get_irq(pdev, 0); 451 496 if (irq < 0) { ··· 487 476 if (IS_ERR(qspi->base)) { 488 477 ret = PTR_ERR(qspi->base); 489 478 goto free_master; 479 + } 480 + 481 + if (res_ctrl) { 482 + qspi->ctrl_mod = true; 483 + qspi->ctrl_base = devm_ioremap_resource(&pdev->dev, res_ctrl); 484 + if (IS_ERR(qspi->ctrl_base)) { 485 + ret = PTR_ERR(qspi->ctrl_base); 486 + goto free_master; 487 + } 488 + } 489 + 490 + if (res_mmap) { 491 + qspi->mmap_base = devm_ioremap_resource(&pdev->dev, res_mmap); 492 + if (IS_ERR(qspi->mmap_base)) { 493 + ret = PTR_ERR(qspi->mmap_base); 494 + goto free_master; 495 + } 490 496 } 491 497 492 498 ret = devm_request_irq(&pdev->dev, irq, ti_qspi_isr, 0, ··· 567 539 .probe = ti_qspi_probe, 568 540 .remove = ti_qspi_remove, 569 541 .driver = { 570 - .name = "ti,dra7xxx-qspi", 542 + .name = "ti-qspi", 571 543 .owner = THIS_MODULE, 572 544 .pm = &ti_qspi_pm_ops, 573 545 .of_match_table = ti_qspi_match, ··· 579 551 MODULE_AUTHOR("Sourav Poddar <sourav.poddar@ti.com>"); 580 552 MODULE_LICENSE("GPL v2"); 581 553 MODULE_DESCRIPTION("TI QSPI controller driver"); 554 + MODULE_ALIAS("platform:ti-qspi");
+2 -6
drivers/spi/spi-txx9.c
··· 348 348 INIT_LIST_HEAD(&c->queue); 349 349 init_waitqueue_head(&c->waitq); 350 350 351 - c->clk = clk_get(&dev->dev, "spi-baseclk"); 351 + c->clk = devm_clk_get(&dev->dev, "spi-baseclk"); 352 352 if (IS_ERR(c->clk)) { 353 353 ret = PTR_ERR(c->clk); 354 354 c->clk = NULL; ··· 356 356 } 357 357 ret = clk_enable(c->clk); 358 358 if (ret) { 359 - clk_put(c->clk); 360 359 c->clk = NULL; 361 360 goto exit; 362 361 } ··· 414 415 exit: 415 416 if (c->workqueue) 416 417 destroy_workqueue(c->workqueue); 417 - if (c->clk) { 418 + if (c->clk) 418 419 clk_disable(c->clk); 419 - clk_put(c->clk); 420 - } 421 420 spi_master_put(master); 422 421 return ret; 423 422 } ··· 427 430 428 431 destroy_workqueue(c->workqueue); 429 432 clk_disable(c->clk); 430 - clk_put(c->clk); 431 433 return 0; 432 434 } 433 435
+1 -11
drivers/spi/spi-xcomm.c
··· 231 231 master->dev.of_node = i2c->dev.of_node; 232 232 i2c_set_clientdata(i2c, master); 233 233 234 - ret = spi_register_master(master); 234 + ret = devm_spi_register_master(&i2c->dev, master); 235 235 if (ret < 0) 236 236 spi_master_put(master); 237 237 238 238 return ret; 239 - } 240 - 241 - static int spi_xcomm_remove(struct i2c_client *i2c) 242 - { 243 - struct spi_master *master = i2c_get_clientdata(i2c); 244 - 245 - spi_unregister_master(master); 246 - 247 - return 0; 248 239 } 249 240 250 241 static const struct i2c_device_id spi_xcomm_ids[] = { ··· 250 259 }, 251 260 .id_table = spi_xcomm_ids, 252 261 .probe = spi_xcomm_probe, 253 - .remove = spi_xcomm_remove, 254 262 }; 255 263 module_i2c_driver(spi_xcomm_driver); 256 264
+2
include/linux/spi/s3c24xx.h
··· 23 23 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 24 24 }; 25 25 26 + extern int s3c24xx_set_fiq(unsigned int irq, bool on); 27 + 26 28 #endif /* __LINUX_SPI_S3C24XX_H */