[ARM] 3455/1: ARM: OMAP: 7/8 Misc updates, take 2

Patch from Tony Lindgren

Update misc OMAP core code from linux-omap tree:

- McBSP updates by Samuel Ortiz, Andrzej Zaborowski
- Whitespace cleanups by Ladislav Michl
- Other fixes by various linux-omap developers

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Tony Lindgren and committed by Russell King 120db2cb 0dc5e77c

+684 -73
+9 -2
arch/arm/mach-omap1/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := io.o id.o clock.o irq.o time.o mux.o serial.o devices.o 6 + obj-y := io.o id.o clock.o irq.o mux.o serial.o devices.o 7 + 8 + obj-$(CONFIG_OMAP_MPU_TIMER) += time.o 9 + 10 + # Power Management 11 + obj-$(CONFIG_PM) += pm.o sleep.o 12 + 7 13 led-y := leds.o 8 14 9 15 # Specific board support ··· 20 14 obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o 21 15 obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o 22 16 obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 23 - obj-$(CONFIG_MACH_NETSTAR) += board-netstar.o 24 17 obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 18 + obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o 19 + obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o 25 20 26 21 ifeq ($(CONFIG_ARCH_OMAP15XX),y) 27 22 # Innovator-1510 FPGA
+3 -1
arch/arm/mach-omap1/io.c
··· 18 18 #include <asm/io.h> 19 19 #include <asm/arch/mux.h> 20 20 #include <asm/arch/tc.h> 21 + #include <asm/arch/omapfb.h> 21 22 22 23 extern int omap1_clk_init(void); 23 24 extern void omap_check_revision(void); ··· 111 110 } 112 111 #endif 113 112 #ifdef CONFIG_ARCH_OMAP15XX 114 - if (cpu_is_omap1510()) { 113 + if (cpu_is_omap15xx()) { 115 114 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc)); 116 115 } 117 116 #endif ··· 122 121 #endif 123 122 124 123 omap_sram_init(); 124 + omapfb_reserve_mem(); 125 125 } 126 126 127 127 /*
+9 -9
arch/arm/mach-omap1/irq.c
··· 60 60 unsigned long wake_enable; 61 61 }; 62 62 63 - static unsigned int irq_bank_count = 0; 63 + static unsigned int irq_bank_count; 64 64 static struct omap_irq_bank *irq_banks; 65 65 66 66 static inline unsigned int irq_bank_readl(int bank, int offset) ··· 142 142 143 143 #ifdef CONFIG_ARCH_OMAP730 144 144 static struct omap_irq_bank omap730_irq_banks[] = { 145 - { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3f8e22f }, 146 - { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb9c1f2 }, 145 + { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3f8e22f }, 146 + { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb9c1f2 }, 147 147 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0x800040f3 }, 148 148 }; 149 149 #endif 150 150 151 151 #ifdef CONFIG_ARCH_OMAP15XX 152 152 static struct omap_irq_bank omap1510_irq_banks[] = { 153 - { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3febfff }, 154 - { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xffbfffed }, 153 + { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3febfff }, 154 + { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xffbfffed }, 155 155 }; 156 156 static struct omap_irq_bank omap310_irq_banks[] = { 157 - { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3faefc3 }, 158 - { .base_reg = OMAP_IH2_BASE, .trigger_map = 0x65b3c061 }, 157 + { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3faefc3 }, 158 + { .base_reg = OMAP_IH2_BASE, .trigger_map = 0x65b3c061 }, 159 159 }; 160 160 #endif 161 161 162 162 #if defined(CONFIG_ARCH_OMAP16XX) 163 163 164 164 static struct omap_irq_bank omap1610_irq_banks[] = { 165 - { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f }, 166 - { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd }, 165 + { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f }, 166 + { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd }, 167 167 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xffffb7ff }, 168 168 { .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff }, 169 169 };
+3 -3
arch/arm/mach-omap1/serial.c
··· 30 30 #include <asm/arch/pm.h> 31 31 #endif 32 32 33 - static struct clk * uart1_ck = NULL; 34 - static struct clk * uart2_ck = NULL; 35 - static struct clk * uart3_ck = NULL; 33 + static struct clk * uart1_ck; 34 + static struct clk * uart2_ck; 35 + static struct clk * uart3_ck; 36 36 37 37 static inline unsigned int omap_serial_in(struct plat_serial8250_port *up, 38 38 int offset)
+5 -1
arch/arm/mach-omap2/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := irq.o id.o io.o sram-fn.o clock.o mux.o devices.o serial.o 6 + obj-y := irq.o id.o io.o sram-fn.o memory.o prcm.o clock.o mux.o devices.o serial.o 7 7 8 8 obj-$(CONFIG_OMAP_MPU_TIMER) += timer-gp.o 9 + 10 + # Power Management 11 + obj-$(CONFIG_PM) += pm.o sleep.o 9 12 10 13 # Specific board support 11 14 obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 12 15 obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 16 + obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 13 17
+19 -2
arch/arm/mach-omap2/io.c
··· 16 16 #include <linux/kernel.h> 17 17 #include <linux/init.h> 18 18 19 - #include <asm/mach/map.h> 19 + #include <asm/tlb.h> 20 20 #include <asm/io.h> 21 + 22 + #include <asm/mach/map.h> 23 + 21 24 #include <asm/arch/mux.h> 25 + #include <asm/arch/omapfb.h> 22 26 23 27 extern void omap_sram_init(void); 24 28 extern int omap2_clk_init(void); ··· 47 43 } 48 44 }; 49 45 50 - void __init omap_map_common_io(void) 46 + void __init omap2_map_common_io(void) 51 47 { 52 48 iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc)); 49 + 50 + /* Normally devicemaps_init() would flush caches and tlb after 51 + * mdesc->map_io(), but we must also do it here because of the CPU 52 + * revision check below. 53 + */ 54 + local_flush_tlb_all(); 55 + flush_cache_all(); 56 + 53 57 omap2_check_revision(); 54 58 omap_sram_init(); 59 + omapfb_reserve_mem(); 60 + } 61 + 62 + void __init omap2_init_common_hw(void) 63 + { 55 64 omap2_mux_init(); 56 65 omap2_clk_init(); 57 66 }
+3 -3
arch/arm/plat-omap/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o mcbsp.o usb.o 6 + obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o mcbsp.o usb.o fb.o 7 7 obj-m := 8 8 obj-n := 9 9 obj- := 10 10 11 + obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 12 + 11 13 # OCPI interconnect support for 1710, 1610 and 5912 12 14 obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o 13 15 14 - # Power Management 15 - obj-$(CONFIG_PM) += pm.o sleep.o 16 16 17 17 obj-$(CONFIG_CPU_FREQ) += cpu-omap.o 18 18 obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
+309 -42
arch/arm/plat-omap/mcbsp.c
··· 34 34 #ifdef CONFIG_MCBSP_DEBUG 35 35 #define DBG(x...) printk(x) 36 36 #else 37 - #define DBG(x...) do { } while (0) 37 + #define DBG(x...) do { } while (0) 38 38 #endif 39 39 40 40 struct omap_mcbsp { ··· 44 44 omap_mcbsp_word_length rx_word_length; 45 45 omap_mcbsp_word_length tx_word_length; 46 46 47 + omap_mcbsp_io_type_t io_type; /* IRQ or poll */ 47 48 /* IRQ based TX/RX */ 48 49 int rx_irq; 49 50 int tx_irq; ··· 65 64 }; 66 65 67 66 static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT]; 67 + #ifdef CONFIG_ARCH_OMAP1 68 68 static struct clk *mcbsp_dsp_ck = 0; 69 69 static struct clk *mcbsp_api_ck = 0; 70 70 static struct clk *mcbsp_dspxor_ck = 0; 71 - 71 + #endif 72 + #ifdef CONFIG_ARCH_OMAP2 73 + static struct clk *mcbsp1_ick = 0; 74 + static struct clk *mcbsp1_fck = 0; 75 + static struct clk *mcbsp2_ick = 0; 76 + static struct clk *mcbsp2_fck = 0; 77 + static struct clk *sys_ck = 0; 78 + static struct clk *sys_clkout = 0; 79 + #endif 72 80 73 81 static void omap_mcbsp_dump_reg(u8 id) 74 82 { ··· 98 88 DBG("***********************\n"); 99 89 } 100 90 101 - 102 91 static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id, struct pt_regs *regs) 103 92 { 104 93 struct omap_mcbsp * mcbsp_tx = (struct omap_mcbsp *)(dev_id); ··· 117 108 complete(&mcbsp_rx->rx_irq_completion); 118 109 return IRQ_HANDLED; 119 110 } 120 - 121 111 122 112 static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data) 123 113 { ··· 184 176 return 0; 185 177 } 186 178 187 - if (cpu_is_omap1510() || cpu_is_omap16xx()) { 179 + if (cpu_is_omap15xx() || cpu_is_omap16xx() || cpu_is_omap24xx()) { 188 180 if (id > OMAP_MAX_MCBSP_COUNT) { 189 181 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1); 190 182 return -1; ··· 195 187 return -1; 196 188 } 197 189 190 + #ifdef CONFIG_ARCH_OMAP1 198 191 static void omap_mcbsp_dsp_request(void) 199 192 { 200 - if (cpu_is_omap1510() || cpu_is_omap16xx()) { 193 + if (cpu_is_omap15xx() || cpu_is_omap16xx()) { 201 194 clk_enable(mcbsp_dsp_ck); 202 195 clk_enable(mcbsp_api_ck); 203 196 ··· 216 207 217 208 static void omap_mcbsp_dsp_free(void) 218 209 { 219 - if (cpu_is_omap1510() || cpu_is_omap16xx()) { 210 + if (cpu_is_omap15xx() || cpu_is_omap16xx()) { 220 211 clk_disable(mcbsp_dspxor_ck); 221 212 clk_disable(mcbsp_dsp_ck); 222 213 clk_disable(mcbsp_api_ck); 223 214 } 215 + } 216 + #endif 217 + 218 + #ifdef CONFIG_ARCH_OMAP2 219 + static void omap2_mcbsp2_mux_setup(void) 220 + { 221 + omap_cfg_reg(Y15_24XX_MCBSP2_CLKX); 222 + omap_cfg_reg(R14_24XX_MCBSP2_FSX); 223 + omap_cfg_reg(W15_24XX_MCBSP2_DR); 224 + omap_cfg_reg(V15_24XX_MCBSP2_DX); 225 + omap_cfg_reg(V14_24XX_GPIO117); 226 + omap_cfg_reg(W14_24XX_SYS_CLKOUT); 227 + } 228 + #endif 229 + 230 + /* 231 + * We can choose between IRQ based or polled IO. 232 + * This needs to be called before omap_mcbsp_request(). 233 + */ 234 + int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type) 235 + { 236 + if (omap_mcbsp_check(id) < 0) 237 + return -EINVAL; 238 + 239 + spin_lock(&mcbsp[id].lock); 240 + 241 + if (!mcbsp[id].free) { 242 + printk (KERN_ERR "OMAP-McBSP: McBSP%d is currently in use\n", id + 1); 243 + spin_unlock(&mcbsp[id].lock); 244 + return -EINVAL; 245 + } 246 + 247 + mcbsp[id].io_type = io_type; 248 + 249 + spin_unlock(&mcbsp[id].lock); 250 + 251 + return 0; 224 252 } 225 253 226 254 int omap_mcbsp_request(unsigned int id) ··· 267 221 if (omap_mcbsp_check(id) < 0) 268 222 return -EINVAL; 269 223 224 + #ifdef CONFIG_ARCH_OMAP1 270 225 /* 271 226 * On 1510, 1610 and 1710, McBSP1 and McBSP3 272 227 * are DSP public peripherals. 273 228 */ 274 229 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) 275 230 omap_mcbsp_dsp_request(); 231 + #endif 232 + 233 + #ifdef CONFIG_ARCH_OMAP2 234 + if (cpu_is_omap24xx()) { 235 + if (id == OMAP_MCBSP1) { 236 + clk_enable(mcbsp1_ick); 237 + clk_enable(mcbsp1_fck); 238 + } else { 239 + clk_enable(mcbsp2_ick); 240 + clk_enable(mcbsp2_fck); 241 + } 242 + } 243 + #endif 276 244 277 245 spin_lock(&mcbsp[id].lock); 278 246 if (!mcbsp[id].free) { ··· 298 238 mcbsp[id].free = 0; 299 239 spin_unlock(&mcbsp[id].lock); 300 240 301 - /* We need to get IRQs here */ 302 - err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler, 0, 303 - "McBSP", 304 - (void *) (&mcbsp[id])); 305 - if (err != 0) { 306 - printk(KERN_ERR "OMAP-McBSP: Unable to request TX IRQ %d for McBSP%d\n", 307 - mcbsp[id].tx_irq, mcbsp[id].id); 308 - return err; 241 + if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) { 242 + /* We need to get IRQs here */ 243 + err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler, 0, 244 + "McBSP", 245 + (void *) (&mcbsp[id])); 246 + if (err != 0) { 247 + printk(KERN_ERR "OMAP-McBSP: Unable to request TX IRQ %d for McBSP%d\n", 248 + mcbsp[id].tx_irq, mcbsp[id].id); 249 + return err; 250 + } 251 + 252 + init_completion(&(mcbsp[id].tx_irq_completion)); 253 + 254 + 255 + err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler, 0, 256 + "McBSP", 257 + (void *) (&mcbsp[id])); 258 + if (err != 0) { 259 + printk(KERN_ERR "OMAP-McBSP: Unable to request RX IRQ %d for McBSP%d\n", 260 + mcbsp[id].rx_irq, mcbsp[id].id); 261 + free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 262 + return err; 263 + } 264 + 265 + init_completion(&(mcbsp[id].rx_irq_completion)); 309 266 } 310 267 311 - init_completion(&(mcbsp[id].tx_irq_completion)); 312 - 313 - 314 - err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler, 0, 315 - "McBSP", 316 - (void *) (&mcbsp[id])); 317 - if (err != 0) { 318 - printk(KERN_ERR "OMAP-McBSP: Unable to request RX IRQ %d for McBSP%d\n", 319 - mcbsp[id].rx_irq, mcbsp[id].id); 320 - free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 321 - return err; 322 - } 323 - 324 - init_completion(&(mcbsp[id].rx_irq_completion)); 325 268 return 0; 326 269 327 270 } ··· 334 271 if (omap_mcbsp_check(id) < 0) 335 272 return; 336 273 337 - if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) 338 - omap_mcbsp_dsp_free(); 274 + #ifdef CONFIG_ARCH_OMAP1 275 + if (cpu_class_is_omap1()) { 276 + if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) 277 + omap_mcbsp_dsp_free(); 278 + } 279 + #endif 280 + 281 + #ifdef CONFIG_ARCH_OMAP2 282 + if (cpu_is_omap24xx()) { 283 + if (id == OMAP_MCBSP1) { 284 + clk_disable(mcbsp1_ick); 285 + clk_disable(mcbsp1_fck); 286 + } else { 287 + clk_disable(mcbsp2_ick); 288 + clk_disable(mcbsp2_fck); 289 + } 290 + } 291 + #endif 339 292 340 293 spin_lock(&mcbsp[id].lock); 341 294 if (mcbsp[id].free) { ··· 363 284 mcbsp[id].free = 1; 364 285 spin_unlock(&mcbsp[id].lock); 365 286 366 - /* Free IRQs */ 367 - free_irq(mcbsp[id].rx_irq, (void *) (&mcbsp[id])); 368 - free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 287 + if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) { 288 + /* Free IRQs */ 289 + free_irq(mcbsp[id].rx_irq, (void *) (&mcbsp[id])); 290 + free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 291 + } 369 292 } 370 293 371 294 /* ··· 542 461 } 543 462 544 463 464 + int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 465 + { 466 + u32 io_base = mcbsp[id].io_base; 467 + omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 468 + omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 469 + u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 470 + 471 + if (tx_word_length != rx_word_length) 472 + return -EINVAL; 473 + 474 + /* First we wait for the transmitter to be ready */ 475 + spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 476 + while (!(spcr2 & XRDY)) { 477 + spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 478 + if (attempts++ > 1000) { 479 + /* We must reset the transmitter */ 480 + OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 & (~XRST)); 481 + udelay(10); 482 + OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 483 + udelay(10); 484 + printk("McBSP transmitter not ready\n"); 485 + return -EAGAIN; 486 + } 487 + } 488 + 489 + /* Now we can push the data */ 490 + if (tx_word_length > OMAP_MCBSP_WORD_16) 491 + OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16); 492 + OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff); 493 + 494 + /* We wait for the receiver to be ready */ 495 + spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 496 + while (!(spcr1 & RRDY)) { 497 + spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 498 + if (attempts++ > 1000) { 499 + /* We must reset the receiver */ 500 + OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 & (~RRST)); 501 + udelay(10); 502 + OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 503 + udelay(10); 504 + printk("McBSP receiver not ready\n"); 505 + return -EAGAIN; 506 + } 507 + } 508 + 509 + /* Receiver is ready, let's read the dummy data */ 510 + if (rx_word_length > OMAP_MCBSP_WORD_16) 511 + word_msb = OMAP_MCBSP_READ(io_base, DRR2); 512 + word_lsb = OMAP_MCBSP_READ(io_base, DRR1); 513 + 514 + return 0; 515 + } 516 + 517 + int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word) 518 + { 519 + u32 io_base = mcbsp[id].io_base, clock_word = 0; 520 + omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 521 + omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 522 + u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 523 + 524 + if (tx_word_length != rx_word_length) 525 + return -EINVAL; 526 + 527 + /* First we wait for the transmitter to be ready */ 528 + spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 529 + while (!(spcr2 & XRDY)) { 530 + spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 531 + if (attempts++ > 1000) { 532 + /* We must reset the transmitter */ 533 + OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 & (~XRST)); 534 + udelay(10); 535 + OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 536 + udelay(10); 537 + printk("McBSP transmitter not ready\n"); 538 + return -EAGAIN; 539 + } 540 + } 541 + 542 + /* We first need to enable the bus clock */ 543 + if (tx_word_length > OMAP_MCBSP_WORD_16) 544 + OMAP_MCBSP_WRITE(io_base, DXR2, clock_word >> 16); 545 + OMAP_MCBSP_WRITE(io_base, DXR1, clock_word & 0xffff); 546 + 547 + /* We wait for the receiver to be ready */ 548 + spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 549 + while (!(spcr1 & RRDY)) { 550 + spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 551 + if (attempts++ > 1000) { 552 + /* We must reset the receiver */ 553 + OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 & (~RRST)); 554 + udelay(10); 555 + OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 556 + udelay(10); 557 + printk("McBSP receiver not ready\n"); 558 + return -EAGAIN; 559 + } 560 + } 561 + 562 + /* Receiver is ready, there is something for us */ 563 + if (rx_word_length > OMAP_MCBSP_WORD_16) 564 + word_msb = OMAP_MCBSP_READ(io_base, DRR2); 565 + word_lsb = OMAP_MCBSP_READ(io_base, DRR1); 566 + 567 + word[0] = (word_lsb | (word_msb << 16)); 568 + 569 + return 0; 570 + } 571 + 572 + 545 573 /* 546 574 * Simple DMA based buffer rx/tx routines. 547 575 * Nothing fancy, just a single buffer tx/rx through DMA. ··· 661 471 int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 662 472 { 663 473 int dma_tx_ch; 474 + int src_port = 0; 475 + int dest_port = 0; 476 + int sync_dev = 0; 664 477 665 478 if (omap_mcbsp_check(id) < 0) 666 479 return -EINVAL; ··· 680 487 681 488 init_completion(&(mcbsp[id].tx_dma_completion)); 682 489 490 + if (cpu_class_is_omap1()) { 491 + src_port = OMAP_DMA_PORT_TIPB; 492 + dest_port = OMAP_DMA_PORT_EMIFF; 493 + } 494 + if (cpu_is_omap24xx()) 495 + sync_dev = mcbsp[id].dma_tx_sync; 496 + 683 497 omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch, 684 498 OMAP_DMA_DATA_TYPE_S16, 685 499 length >> 1, 1, 686 500 OMAP_DMA_SYNC_ELEMENT, 687 - 0, 0); 501 + sync_dev, 0); 688 502 689 503 omap_set_dma_dest_params(mcbsp[id].dma_tx_lch, 690 - OMAP_DMA_PORT_TIPB, 504 + src_port, 691 505 OMAP_DMA_AMODE_CONSTANT, 692 506 mcbsp[id].io_base + OMAP_MCBSP_REG_DXR1, 693 507 0, 0); 694 508 695 509 omap_set_dma_src_params(mcbsp[id].dma_tx_lch, 696 - OMAP_DMA_PORT_EMIFF, 510 + dest_port, 697 511 OMAP_DMA_AMODE_POST_INC, 698 512 buffer, 699 513 0, 0); ··· 714 514 int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 715 515 { 716 516 int dma_rx_ch; 517 + int src_port = 0; 518 + int dest_port = 0; 519 + int sync_dev = 0; 717 520 718 521 if (omap_mcbsp_check(id) < 0) 719 522 return -EINVAL; ··· 733 530 734 531 init_completion(&(mcbsp[id].rx_dma_completion)); 735 532 533 + if (cpu_class_is_omap1()) { 534 + src_port = OMAP_DMA_PORT_TIPB; 535 + dest_port = OMAP_DMA_PORT_EMIFF; 536 + } 537 + if (cpu_is_omap24xx()) 538 + sync_dev = mcbsp[id].dma_rx_sync; 539 + 736 540 omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch, 737 541 OMAP_DMA_DATA_TYPE_S16, 738 542 length >> 1, 1, 739 543 OMAP_DMA_SYNC_ELEMENT, 740 - 0, 0); 544 + sync_dev, 0); 741 545 742 546 omap_set_dma_src_params(mcbsp[id].dma_rx_lch, 743 - OMAP_DMA_PORT_TIPB, 547 + src_port, 744 548 OMAP_DMA_AMODE_CONSTANT, 745 549 mcbsp[id].io_base + OMAP_MCBSP_REG_DRR1, 746 550 0, 0); 747 551 748 552 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, 749 - OMAP_DMA_PORT_EMIFF, 553 + dest_port, 750 554 OMAP_DMA_AMODE_POST_INC, 751 555 buffer, 752 556 0, 0); ··· 898 688 }; 899 689 #endif 900 690 691 + #if defined(CONFIG_ARCH_OMAP24XX) 692 + static const struct omap_mcbsp_info mcbsp_24xx[] = { 693 + [0] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE), 694 + .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, 695 + .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, 696 + .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 697 + .tx_irq = INT_24XX_MCBSP1_IRQ_TX, 698 + }, 699 + [1] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE), 700 + .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, 701 + .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, 702 + .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 703 + .tx_irq = INT_24XX_MCBSP2_IRQ_TX, 704 + }, 705 + }; 706 + #endif 707 + 901 708 static int __init omap_mcbsp_init(void) 902 709 { 903 710 int mcbsp_count = 0, i; ··· 922 695 923 696 printk("Initializing OMAP McBSP system\n"); 924 697 698 + #ifdef CONFIG_ARCH_OMAP1 925 699 mcbsp_dsp_ck = clk_get(0, "dsp_ck"); 926 700 if (IS_ERR(mcbsp_dsp_ck)) { 927 701 printk(KERN_ERR "mcbsp: could not acquire dsp_ck handle.\n"); ··· 938 710 printk(KERN_ERR "mcbsp: could not acquire dspxor_ck handle.\n"); 939 711 return PTR_ERR(mcbsp_dspxor_ck); 940 712 } 713 + #endif 714 + #ifdef CONFIG_ARCH_OMAP2 715 + mcbsp1_ick = clk_get(0, "mcbsp1_ick"); 716 + if (IS_ERR(mcbsp1_ick)) { 717 + printk(KERN_ERR "mcbsp: could not acquire mcbsp1_ick handle.\n"); 718 + return PTR_ERR(mcbsp1_ick); 719 + } 720 + mcbsp1_fck = clk_get(0, "mcbsp1_fck"); 721 + if (IS_ERR(mcbsp1_fck)) { 722 + printk(KERN_ERR "mcbsp: could not acquire mcbsp1_fck handle.\n"); 723 + return PTR_ERR(mcbsp1_fck); 724 + } 725 + mcbsp2_ick = clk_get(0, "mcbsp2_ick"); 726 + if (IS_ERR(mcbsp2_ick)) { 727 + printk(KERN_ERR "mcbsp: could not acquire mcbsp2_ick handle.\n"); 728 + return PTR_ERR(mcbsp2_ick); 729 + } 730 + mcbsp2_fck = clk_get(0, "mcbsp2_fck"); 731 + if (IS_ERR(mcbsp2_fck)) { 732 + printk(KERN_ERR "mcbsp: could not acquire mcbsp2_fck handle.\n"); 733 + return PTR_ERR(mcbsp2_fck); 734 + } 735 + #endif 941 736 942 737 #ifdef CONFIG_ARCH_OMAP730 943 738 if (cpu_is_omap730()) { ··· 969 718 } 970 719 #endif 971 720 #ifdef CONFIG_ARCH_OMAP15XX 972 - if (cpu_is_omap1510()) { 721 + if (cpu_is_omap15xx()) { 973 722 mcbsp_info = mcbsp_1510; 974 723 mcbsp_count = ARRAY_SIZE(mcbsp_1510); 975 724 } ··· 978 727 if (cpu_is_omap16xx()) { 979 728 mcbsp_info = mcbsp_1610; 980 729 mcbsp_count = ARRAY_SIZE(mcbsp_1610); 730 + } 731 + #endif 732 + #if defined(CONFIG_ARCH_OMAP24XX) 733 + if (cpu_is_omap24xx()) { 734 + mcbsp_info = mcbsp_24xx; 735 + mcbsp_count = ARRAY_SIZE(mcbsp_24xx); 736 + 737 + /* REVISIT: where's the right place? */ 738 + omap2_mcbsp2_mux_setup(); 739 + sys_ck = clk_get(0, "sys_ck"); 740 + sys_clkout = clk_get(0, "sys_clkout"); 741 + clk_set_parent(sys_clkout, sys_ck); 742 + clk_enable(sys_clkout); 981 743 } 982 744 #endif 983 745 for (i = 0; i < OMAP_MAX_MCBSP_COUNT ; i++) { ··· 1005 741 mcbsp[i].dma_rx_lch = -1; 1006 742 1007 743 mcbsp[i].io_base = mcbsp_info[i].virt_base; 744 + mcbsp[i].io_type = OMAP_MCBSP_IRQ_IO; /* Default I/O is IRQ based */ 1008 745 mcbsp[i].tx_irq = mcbsp_info[i].tx_irq; 1009 746 mcbsp[i].rx_irq = mcbsp_info[i].rx_irq; 1010 747 mcbsp[i].dma_rx_sync = mcbsp_info[i].dma_rx_sync; ··· 1016 751 return 0; 1017 752 } 1018 753 1019 - 1020 754 arch_initcall(omap_mcbsp_init); 1021 755 1022 756 EXPORT_SYMBOL(omap_mcbsp_config); 1023 757 EXPORT_SYMBOL(omap_mcbsp_request); 758 + EXPORT_SYMBOL(omap_mcbsp_set_io_type); 1024 759 EXPORT_SYMBOL(omap_mcbsp_free); 1025 760 EXPORT_SYMBOL(omap_mcbsp_start); 1026 761 EXPORT_SYMBOL(omap_mcbsp_stop); ··· 1028 763 EXPORT_SYMBOL(omap_mcbsp_recv_word); 1029 764 EXPORT_SYMBOL(omap_mcbsp_xmit_buffer); 1030 765 EXPORT_SYMBOL(omap_mcbsp_recv_buffer); 766 + EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll); 767 + EXPORT_SYMBOL(omap_mcbsp_spi_master_recv_word_poll); 1031 768 EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
-3
arch/arm/plat-omap/ocpi.c
··· 62 62 if (!cpu_is_omap16xx()) 63 63 return -ENODEV; 64 64 65 - /* Make sure there's clock for OCPI */ 66 - clk_enable(ocpi_ck); 67 - 68 65 /* Enable access for OHCI in OCPI */ 69 66 val = omap_readl(OCPI_PROT); 70 67 val &= ~0xff;
+4
include/asm-arm/arch-omap/aic23.h
··· 57 57 #define LHV_MIN 0x0000 58 58 59 59 // Analog audio path control register 60 + #define STA_REG(x) ((x)<<6) 60 61 #define STE_ENABLED 0x0020 61 62 #define DAC_SELECTED 0x0010 62 63 #define BYPASS_ON 0x0008 ··· 109 108 110 109 #define TLV320AIC23ID1 (0x1a) // cs low 111 110 #define TLV320AIC23ID2 (0x1b) // cs high 111 + 112 + void tlv320aic23_power_up(void); 113 + void tlv320aic23_power_down(void); 112 114 113 115 #endif /* __ASM_ARCH_AIC23_H */
+6
include/asm-arm/arch-omap/dsp.h
··· 181 181 #define OMAP_DSP_MBCMD_PM_ENABLE 0x01 182 182 183 183 #define OMAP_DSP_MBCMD_KFUNC_FBCTL 0x00 184 + #define OMAP_DSP_MBCMD_KFUNC_AUDIO_PWR 0x01 184 185 186 + #define OMAP_DSP_MBCMD_FBCTL_UPD 0x0000 185 187 #define OMAP_DSP_MBCMD_FBCTL_ENABLE 0x0002 186 188 #define OMAP_DSP_MBCMD_FBCTL_DISABLE 0x0003 189 + 190 + #define OMAP_DSP_MBCMD_AUDIO_PWR_UP 0x0000 191 + #define OMAP_DSP_MBCMD_AUDIO_PWR_DOWN1 0x0001 192 + #define OMAP_DSP_MBCMD_AUDIO_PWR_DOWN2 0x0002 187 193 188 194 #define OMAP_DSP_MBCMD_TDEL_SAFE 0x0000 189 195 #define OMAP_DSP_MBCMD_TDEL_KILL 0x0001
+7 -6
include/asm-arm/arch-omap/dsp_common.h
··· 27 27 #ifndef ASM_ARCH_DSP_COMMON_H 28 28 #define ASM_ARCH_DSP_COMMON_H 29 29 30 - void omap_dsp_pm_suspend(void); 31 - void omap_dsp_pm_resume(void); 32 - void omap_dsp_request_mpui(void); 33 - void omap_dsp_release_mpui(void); 34 - int omap_dsp_request_mem(void); 35 - int omap_dsp_release_mem(void); 30 + extern void omap_dsp_request_mpui(void); 31 + extern void omap_dsp_release_mpui(void); 32 + extern int omap_dsp_request_mem(void); 33 + extern int omap_dsp_release_mem(void); 34 + 35 + extern void (*omap_dsp_audio_pwr_up_request)(int stage); 36 + extern void (*omap_dsp_audio_pwr_down_request)(int stage); 36 37 37 38 #endif /* ASM_ARCH_DSP_COMMON_H */
+24
include/asm-arm/arch-omap/gpioexpander.h
··· 1 + /* 2 + * linux/include/asm-arm/arch-omap/gpioexpander.h 3 + * 4 + * 5 + * Copyright (C) 2004 Texas Instruments, Inc. 6 + * 7 + * This package is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + * 11 + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 12 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 13 + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14 + */ 15 + 16 + #ifndef __ASM_ARCH_OMAP_GPIOEXPANDER_H 17 + #define __ASM_ARCH_OMAP_GPIOEXPANDER_H 18 + 19 + /* Function Prototypes for GPIO Expander functions */ 20 + 21 + int read_gpio_expa(u8 *, int); 22 + int write_gpio_expa(u8 , int); 23 + 24 + #endif /* __ASM_ARCH_OMAP_GPIOEXPANDER_H */
+36
include/asm-arm/arch-omap/irda.h
··· 1 + /* 2 + * linux/include/asm-arm/arch-omap/irda.h 3 + * 4 + * Copyright (C) 2005-2006 Komal Shah <komal_shah802003@yahoo.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 + #ifndef ASMARM_ARCH_IRDA_H 11 + #define ASMARM_ARCH_IRDA_H 12 + 13 + /* board specific transceiver capabilities */ 14 + 15 + #define IR_SEL 1 /* Selects IrDA */ 16 + #define IR_SIRMODE 2 17 + #define IR_FIRMODE 4 18 + #define IR_MIRMODE 8 19 + 20 + struct omap_irda_config { 21 + int transceiver_cap; 22 + int (*transceiver_mode)(struct device *dev, int mode); 23 + int (*select_irda)(struct device *dev, int state); 24 + /* Very specific to the needs of some platforms (h3,h4) 25 + * having calls which can sleep in irda_set_speed. 26 + */ 27 + struct work_struct gpio_expa; 28 + int rx_channel; 29 + int tx_channel; 30 + unsigned long dest_start; 31 + unsigned long src_start; 32 + int tx_trigger; 33 + int rx_trigger; 34 + }; 35 + 36 + #endif
+5
include/asm-arm/arch-omap/irqs.h
··· 242 242 #define INT_24XX_GPIO_BANK2 30 243 243 #define INT_24XX_GPIO_BANK3 31 244 244 #define INT_24XX_GPIO_BANK4 32 245 + #define INT_24XX_MCBSP1_IRQ_TX 59 246 + #define INT_24XX_MCBSP1_IRQ_RX 60 247 + #define INT_24XX_MCBSP2_IRQ_TX 62 248 + #define INT_24XX_MCBSP2_IRQ_RX 63 249 + #define INT_24XX_UART3_IRQ 74 245 250 246 251 /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and 247 252 * 16 MPUIO lines */
+36
include/asm-arm/arch-omap/keypad.h
··· 1 + /* 2 + * linux/include/asm-arm/arch-omap/keypad.h 3 + * 4 + * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.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 + #ifndef ASMARM_ARCH_KEYPAD_H 11 + #define ASMARM_ARCH_KEYPAD_H 12 + 13 + struct omap_kp_platform_data { 14 + int rows; 15 + int cols; 16 + int *keymap; 17 + unsigned int rep:1; 18 + /* specific to OMAP242x*/ 19 + unsigned int *row_gpios; 20 + unsigned int *col_gpios; 21 + }; 22 + 23 + /* Group (0..3) -- when multiple keys are pressed, only the 24 + * keys pressed in the same group are considered as pressed. This is 25 + * in order to workaround certain crappy HW designs that produce ghost 26 + * keypresses. */ 27 + #define GROUP_0 (0 << 16) 28 + #define GROUP_1 (1 << 16) 29 + #define GROUP_2 (2 << 16) 30 + #define GROUP_3 (3 << 16) 31 + #define GROUP_MASK GROUP_3 32 + 33 + #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val)) 34 + 35 + #endif 36 +
+65
include/asm-arm/arch-omap/mcbsp.h
··· 37 37 #define OMAP1610_MCBSP2_BASE 0xfffb1000 38 38 #define OMAP1610_MCBSP3_BASE 0xe1017000 39 39 40 + #define OMAP24XX_MCBSP1_BASE 0x48074000 41 + #define OMAP24XX_MCBSP2_BASE 0x48076000 42 + 43 + #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) 44 + 40 45 #define OMAP_MCBSP_REG_DRR2 0x00 41 46 #define OMAP_MCBSP_REG_DRR1 0x02 42 47 #define OMAP_MCBSP_REG_DXR2 0x04 ··· 76 71 77 72 #define OMAP_MAX_MCBSP_COUNT 3 78 73 74 + #define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1) 75 + #define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1) 76 + 77 + #define AUDIO_MCBSP OMAP_MCBSP1 78 + #define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX 79 + #define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX 80 + 81 + #elif defined(CONFIG_ARCH_OMAP24XX) 82 + 83 + #define OMAP_MCBSP_REG_DRR2 0x00 84 + #define OMAP_MCBSP_REG_DRR1 0x04 85 + #define OMAP_MCBSP_REG_DXR2 0x08 86 + #define OMAP_MCBSP_REG_DXR1 0x0C 87 + #define OMAP_MCBSP_REG_SPCR2 0x10 88 + #define OMAP_MCBSP_REG_SPCR1 0x14 89 + #define OMAP_MCBSP_REG_RCR2 0x18 90 + #define OMAP_MCBSP_REG_RCR1 0x1C 91 + #define OMAP_MCBSP_REG_XCR2 0x20 92 + #define OMAP_MCBSP_REG_XCR1 0x24 93 + #define OMAP_MCBSP_REG_SRGR2 0x28 94 + #define OMAP_MCBSP_REG_SRGR1 0x2C 95 + #define OMAP_MCBSP_REG_MCR2 0x30 96 + #define OMAP_MCBSP_REG_MCR1 0x34 97 + #define OMAP_MCBSP_REG_RCERA 0x38 98 + #define OMAP_MCBSP_REG_RCERB 0x3C 99 + #define OMAP_MCBSP_REG_XCERA 0x40 100 + #define OMAP_MCBSP_REG_XCERB 0x44 101 + #define OMAP_MCBSP_REG_PCR0 0x48 102 + #define OMAP_MCBSP_REG_RCERC 0x4C 103 + #define OMAP_MCBSP_REG_RCERD 0x50 104 + #define OMAP_MCBSP_REG_XCERC 0x54 105 + #define OMAP_MCBSP_REG_XCERD 0x58 106 + #define OMAP_MCBSP_REG_RCERE 0x5C 107 + #define OMAP_MCBSP_REG_RCERF 0x60 108 + #define OMAP_MCBSP_REG_XCERE 0x64 109 + #define OMAP_MCBSP_REG_XCERF 0x68 110 + #define OMAP_MCBSP_REG_RCERG 0x6C 111 + #define OMAP_MCBSP_REG_RCERH 0x70 112 + #define OMAP_MCBSP_REG_XCERG 0x74 113 + #define OMAP_MCBSP_REG_XCERH 0x78 114 + 115 + #define OMAP_MAX_MCBSP_COUNT 2 116 + 117 + #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) 118 + #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) 119 + 120 + #define AUDIO_MCBSP OMAP_MCBSP2 121 + #define AUDIO_DMA_TX OMAP24XX_DMA_MCBSP2_TX 122 + #define AUDIO_DMA_RX OMAP24XX_DMA_MCBSP2_RX 123 + 124 + #endif 125 + 79 126 #define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg) 80 127 #define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg) 128 + 81 129 82 130 /************************** McBSP SPCR1 bit definitions ***********************/ 83 131 #define RRST 0x0001 ··· 253 195 OMAP_MCBSP3, 254 196 } omap_mcbsp_id; 255 197 198 + typedef int __bitwise omap_mcbsp_io_type_t; 199 + #define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1) 200 + #define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2) 201 + 256 202 typedef enum { 257 203 OMAP_MCBSP_WORD_8 = 0, 258 204 OMAP_MCBSP_WORD_12, ··· 308 246 309 247 int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); 310 248 int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); 249 + int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word); 250 + int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); 251 + 311 252 312 253 /* SPI specific API */ 313 254 void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg);
+16
include/asm-arm/arch-omap/mcspi.h
··· 1 + #ifndef _OMAP2_MCSPI_H 2 + #define _OMAP2_MCSPI_H 3 + 4 + struct omap2_mcspi_platform_config { 5 + unsigned long base; 6 + unsigned short num_cs; 7 + }; 8 + 9 + struct omap2_mcspi_device_config { 10 + unsigned turbo_mode:1; 11 + 12 + /* Do we want one channel enabled at the same time? */ 13 + unsigned single_channel:1; 14 + }; 15 + 16 + #endif
+1 -1
include/asm-arm/arch-omap/menelaus.h
··· 7 7 #ifndef __ASM_ARCH_MENELAUS_H 8 8 #define __ASM_ARCH_MENELAUS_H 9 9 10 - extern void menelaus_mmc_register(void (*callback)(u8 card_mask), 10 + extern void menelaus_mmc_register(void (*callback)(unsigned long data, u8 card_mask), 11 11 unsigned long data); 12 12 extern void menelaus_mmc_remove(void); 13 13 extern void menelaus_mmc_opendrain(int enable);
+124
include/asm-arm/arch-omap/omap-alsa.h
··· 1 + /* 2 + * linux/include/asm-arm/arch-omap/omap-alsa.h 3 + * 4 + * Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards. 5 + * 6 + * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> 7 + * 8 + * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil 9 + * Written by Daniel Petrini, David Cohen, Anderson Briglia 10 + * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br 11 + * 12 + * This program is free software; you can redistribute it and/or modify it 13 + * under the terms of the GNU General Public License as published by the 14 + * Free Software Foundation; either version 2 of the License, or (at your 15 + * option) any later version. 16 + * 17 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 18 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 20 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 + * 28 + * You should have received a copy of the GNU General Public License along 29 + * with this program; if not, write to the Free Software Foundation, Inc., 30 + * 675 Mass Ave, Cambridge, MA 02139, USA. 31 + * 32 + * History 33 + * ------- 34 + * 35 + * 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk, 36 + * original version based in sa1100 driver 37 + * and omap oss driver. 38 + */ 39 + 40 + #ifndef __OMAP_ALSA_H 41 + #define __OMAP_ALSA_H 42 + 43 + #include <sound/driver.h> 44 + #include <asm/arch/dma.h> 45 + #include <sound/core.h> 46 + #include <sound/pcm.h> 47 + #include <asm/arch/mcbsp.h> 48 + #include <linux/platform_device.h> 49 + 50 + #define DMA_BUF_SIZE (1024 * 8) 51 + 52 + /* 53 + * Buffer management for alsa and dma 54 + */ 55 + struct audio_stream { 56 + char *id; /* identification string */ 57 + int stream_id; /* numeric identification */ 58 + int dma_dev; /* dma number of that device */ 59 + int *lch; /* Chain of channels this stream is linked to */ 60 + char started; /* to store if the chain was started or not */ 61 + int dma_q_head; /* DMA Channel Q Head */ 62 + int dma_q_tail; /* DMA Channel Q Tail */ 63 + char dma_q_count; /* DMA Channel Q Count */ 64 + int active:1; /* we are using this stream for transfer now */ 65 + int period; /* current transfer period */ 66 + int periods; /* current count of periods registerd in the DMA engine */ 67 + spinlock_t dma_lock; /* for locking in DMA operations */ 68 + snd_pcm_substream_t *stream; /* the pcm stream */ 69 + unsigned linked:1; /* dma channels linked */ 70 + int offset; /* store start position of the last period in the alsa buffer */ 71 + int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ 72 + int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */ 73 + }; 74 + 75 + /* 76 + * Alsa card structure for aic23 77 + */ 78 + struct snd_card_omap_codec { 79 + snd_card_t *card; 80 + snd_pcm_t *pcm; 81 + long samplerate; 82 + struct audio_stream s[2]; /* playback & capture */ 83 + }; 84 + 85 + /* Codec specific information and function pointers. 86 + * Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c) 87 + * are responsible for defining the function pointers. 88 + */ 89 + struct omap_alsa_codec_config { 90 + char *name; 91 + struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa; 92 + snd_pcm_hw_constraint_list_t *hw_constraints_rates; 93 + snd_pcm_hardware_t *snd_omap_alsa_playback; 94 + snd_pcm_hardware_t *snd_omap_alsa_capture; 95 + void (*codec_configure_dev)(void); 96 + void (*codec_set_samplerate)(long); 97 + void (*codec_clock_setup)(void); 98 + int (*codec_clock_on)(void); 99 + int (*codec_clock_off)(void); 100 + int (*get_default_samplerate)(void); 101 + }; 102 + 103 + /*********** Mixer function prototypes *************************/ 104 + int snd_omap_mixer(struct snd_card_omap_codec *); 105 + void snd_omap_init_mixer(void); 106 + 107 + #ifdef CONFIG_PM 108 + void snd_omap_suspend_mixer(void); 109 + void snd_omap_resume_mixer(void); 110 + #endif 111 + 112 + int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config); 113 + int snd_omap_alsa_remove(struct platform_device *pdev); 114 + #ifdef CONFIG_PM 115 + int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state); 116 + int snd_omap_alsa_resume(struct platform_device *pdev); 117 + #else 118 + #define snd_omap_alsa_suspend NULL 119 + #define snd_omap_alsa_resume NULL 120 + #endif 121 + 122 + void callback_omap_alsa_sound_dma(void *); 123 + 124 + #endif