diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-19 04:47:30 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-19 04:47:30 -0400 |
commit | 0d4a42f6bd298e826620585e766a154ab460617a (patch) | |
tree | 406d8f7778691d858dbe3e48e4bbb10e99c0a58a /include/linux/spi | |
parent | d62b4892f3d9f7dd2002e5309be10719d6805b0f (diff) | |
parent | a937536b868b8369b98967929045f1df54234323 (diff) |
Merge tag 'v3.9-rc3' into drm-intel-next-queued
Backmerge so that I can merge Imre Deak's coalesced sg entries fixes,
which depend upon the new for_each_sg_page introduce in
commit a321e91b6d73ed011ffceed384c40d2785cf723b
Author: Imre Deak <imre.deak@intel.com>
Date: Wed Feb 27 17:02:56 2013 -0800
lib/scatterlist: add simple page iterator
The merge itself is just two trivial conflicts:
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/pxa2xx_spi.h | 108 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 49 | ||||
-rw-r--r-- | include/linux/spi/spi_gpio.h | 4 |
3 files changed, 61 insertions, 100 deletions
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index c73d1445c77e..82d5111cd0c2 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h | |||
@@ -28,6 +28,15 @@ struct pxa2xx_spi_master { | |||
28 | u32 clock_enable; | 28 | u32 clock_enable; |
29 | u16 num_chipselect; | 29 | u16 num_chipselect; |
30 | u8 enable_dma; | 30 | u8 enable_dma; |
31 | |||
32 | /* DMA engine specific config */ | ||
33 | int rx_chan_id; | ||
34 | int tx_chan_id; | ||
35 | int rx_slave_id; | ||
36 | int tx_slave_id; | ||
37 | |||
38 | /* For non-PXA arches */ | ||
39 | struct ssp_device ssp; | ||
31 | }; | 40 | }; |
32 | 41 | ||
33 | /* spi_board_info.controller_data for SPI slave devices, | 42 | /* spi_board_info.controller_data for SPI slave devices, |
@@ -35,6 +44,7 @@ struct pxa2xx_spi_master { | |||
35 | */ | 44 | */ |
36 | struct pxa2xx_spi_chip { | 45 | struct pxa2xx_spi_chip { |
37 | u8 tx_threshold; | 46 | u8 tx_threshold; |
47 | u8 tx_hi_threshold; | ||
38 | u8 rx_threshold; | 48 | u8 rx_threshold; |
39 | u8 dma_burst_size; | 49 | u8 dma_burst_size; |
40 | u32 timeout; | 50 | u32 timeout; |
@@ -50,103 +60,5 @@ struct pxa2xx_spi_chip { | |||
50 | 60 | ||
51 | extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); | 61 | extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); |
52 | 62 | ||
53 | #else | ||
54 | /* | ||
55 | * This is the implemtation for CE4100 on x86. ARM defines them in mach/ or | ||
56 | * plat/ include path. | ||
57 | * The CE4100 does not provide DMA support. This bits are here to let the driver | ||
58 | * compile and will never be used. Maybe we get DMA support at a later point in | ||
59 | * time. | ||
60 | */ | ||
61 | |||
62 | #define DCSR(n) (n) | ||
63 | #define DSADR(n) (n) | ||
64 | #define DTADR(n) (n) | ||
65 | #define DCMD(n) (n) | ||
66 | #define DRCMR(n) (n) | ||
67 | |||
68 | #define DCSR_RUN (1 << 31) /* Run Bit */ | ||
69 | #define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch */ | ||
70 | #define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable */ | ||
71 | #define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ | ||
72 | #define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ | ||
73 | #define DCSR_ENDINTR (1 << 2) /* End Interrupt */ | ||
74 | #define DCSR_STARTINTR (1 << 1) /* Start Interrupt */ | ||
75 | #define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt */ | ||
76 | |||
77 | #define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable */ | ||
78 | #define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */ | ||
79 | #define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */ | ||
80 | #define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */ | ||
81 | #define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ | ||
82 | #define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ | ||
83 | #define DCSR_EORINTR (1 << 9) /* The end of Receive */ | ||
84 | |||
85 | #define DRCMR_MAPVLD (1 << 7) /* Map Valid */ | ||
86 | #define DRCMR_CHLNUM 0x1f /* mask for Channel Number */ | ||
87 | |||
88 | #define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor */ | ||
89 | #define DDADR_STOP (1 << 0) /* Stop */ | ||
90 | |||
91 | #define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */ | ||
92 | #define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */ | ||
93 | #define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */ | ||
94 | #define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */ | ||
95 | #define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */ | ||
96 | #define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */ | ||
97 | #define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */ | ||
98 | #define DCMD_BURST8 (1 << 16) /* 8 byte burst */ | ||
99 | #define DCMD_BURST16 (2 << 16) /* 16 byte burst */ | ||
100 | #define DCMD_BURST32 (3 << 16) /* 32 byte burst */ | ||
101 | #define DCMD_WIDTH1 (1 << 14) /* 1 byte width */ | ||
102 | #define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */ | ||
103 | #define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ | ||
104 | #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ | ||
105 | |||
106 | /* | ||
107 | * Descriptor structure for PXA's DMA engine | ||
108 | * Note: this structure must always be aligned to a 16-byte boundary. | ||
109 | */ | ||
110 | |||
111 | typedef enum { | ||
112 | DMA_PRIO_HIGH = 0, | ||
113 | DMA_PRIO_MEDIUM = 1, | ||
114 | DMA_PRIO_LOW = 2 | ||
115 | } pxa_dma_prio; | ||
116 | |||
117 | /* | ||
118 | * DMA registration | ||
119 | */ | ||
120 | |||
121 | static inline int pxa_request_dma(char *name, | ||
122 | pxa_dma_prio prio, | ||
123 | void (*irq_handler)(int, void *), | ||
124 | void *data) | ||
125 | { | ||
126 | return -ENODEV; | ||
127 | } | ||
128 | |||
129 | static inline void pxa_free_dma(int dma_ch) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * The CE4100 does not have the clk framework implemented and SPI clock can | ||
135 | * not be switched on/off or the divider changed. | ||
136 | */ | ||
137 | static inline void clk_disable(struct clk *clk) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | static inline int clk_enable(struct clk *clk) | ||
142 | { | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static inline unsigned long clk_get_rate(struct clk *clk) | ||
147 | { | ||
148 | return 3686400; | ||
149 | } | ||
150 | |||
151 | #endif | 63 | #endif |
152 | #endif | 64 | #endif |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index f62918946d86..38c2b925923d 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -57,6 +57,8 @@ extern struct bus_type spi_bus_type; | |||
57 | * @modalias: Name of the driver to use with this device, or an alias | 57 | * @modalias: Name of the driver to use with this device, or an alias |
58 | * for that name. This appears in the sysfs "modalias" attribute | 58 | * for that name. This appears in the sysfs "modalias" attribute |
59 | * for driver coldplugging, and in uevents used for hotplugging | 59 | * for driver coldplugging, and in uevents used for hotplugging |
60 | * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when | ||
61 | * when not using a GPIO line) | ||
60 | * | 62 | * |
61 | * A @spi_device is used to interchange data between an SPI slave | 63 | * A @spi_device is used to interchange data between an SPI slave |
62 | * (usually a discrete chip) and CPU memory. | 64 | * (usually a discrete chip) and CPU memory. |
@@ -258,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
258 | * @unprepare_transfer_hardware: there are currently no more messages on the | 260 | * @unprepare_transfer_hardware: there are currently no more messages on the |
259 | * queue so the subsystem notifies the driver that it may relax the | 261 | * queue so the subsystem notifies the driver that it may relax the |
260 | * hardware by issuing this call | 262 | * hardware by issuing this call |
263 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS | ||
264 | * number. Any individual value may be -EINVAL for CS lines that | ||
265 | * are not GPIOs (driven by the SPI controller itself). | ||
261 | * | 266 | * |
262 | * Each SPI master controller can communicate with one or more @spi_device | 267 | * Each SPI master controller can communicate with one or more @spi_device |
263 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 268 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
@@ -591,6 +596,26 @@ spi_transfer_del(struct spi_transfer *t) | |||
591 | list_del(&t->transfer_list); | 596 | list_del(&t->transfer_list); |
592 | } | 597 | } |
593 | 598 | ||
599 | /** | ||
600 | * spi_message_init_with_transfers - Initialize spi_message and append transfers | ||
601 | * @m: spi_message to be initialized | ||
602 | * @xfers: An array of spi transfers | ||
603 | * @num_xfers: Number of items in the xfer array | ||
604 | * | ||
605 | * This function initializes the given spi_message and adds each spi_transfer in | ||
606 | * the given array to the message. | ||
607 | */ | ||
608 | static inline void | ||
609 | spi_message_init_with_transfers(struct spi_message *m, | ||
610 | struct spi_transfer *xfers, unsigned int num_xfers) | ||
611 | { | ||
612 | unsigned int i; | ||
613 | |||
614 | spi_message_init(m); | ||
615 | for (i = 0; i < num_xfers; ++i) | ||
616 | spi_message_add_tail(&xfers[i], m); | ||
617 | } | ||
618 | |||
594 | /* It's fine to embed message and transaction structures in other data | 619 | /* It's fine to embed message and transaction structures in other data |
595 | * structures so long as you don't free them while they're in use. | 620 | * structures so long as you don't free them while they're in use. |
596 | */ | 621 | */ |
@@ -683,6 +708,30 @@ spi_read(struct spi_device *spi, void *buf, size_t len) | |||
683 | return spi_sync(spi, &m); | 708 | return spi_sync(spi, &m); |
684 | } | 709 | } |
685 | 710 | ||
711 | /** | ||
712 | * spi_sync_transfer - synchronous SPI data transfer | ||
713 | * @spi: device with which data will be exchanged | ||
714 | * @xfers: An array of spi_transfers | ||
715 | * @num_xfers: Number of items in the xfer array | ||
716 | * Context: can sleep | ||
717 | * | ||
718 | * Does a synchronous SPI data transfer of the given spi_transfer array. | ||
719 | * | ||
720 | * For more specific semantics see spi_sync(). | ||
721 | * | ||
722 | * It returns zero on success, else a negative error code. | ||
723 | */ | ||
724 | static inline int | ||
725 | spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, | ||
726 | unsigned int num_xfers) | ||
727 | { | ||
728 | struct spi_message msg; | ||
729 | |||
730 | spi_message_init_with_transfers(&msg, xfers, num_xfers); | ||
731 | |||
732 | return spi_sync(spi, &msg); | ||
733 | } | ||
734 | |||
686 | /* this copies txbuf and rxbuf data; for small transfers only! */ | 735 | /* this copies txbuf and rxbuf data; for small transfers only! */ |
687 | extern int spi_write_then_read(struct spi_device *spi, | 736 | extern int spi_write_then_read(struct spi_device *spi, |
688 | const void *txbuf, unsigned n_tx, | 737 | const void *txbuf, unsigned n_tx, |
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h index 369b3d7d5b95..1634ce31c06d 100644 --- a/include/linux/spi/spi_gpio.h +++ b/include/linux/spi/spi_gpio.h | |||
@@ -62,8 +62,8 @@ | |||
62 | */ | 62 | */ |
63 | struct spi_gpio_platform_data { | 63 | struct spi_gpio_platform_data { |
64 | unsigned sck; | 64 | unsigned sck; |
65 | unsigned mosi; | 65 | unsigned long mosi; |
66 | unsigned miso; | 66 | unsigned long miso; |
67 | 67 | ||
68 | u16 num_chipselect; | 68 | u16 num_chipselect; |
69 | }; | 69 | }; |