19a322993SPhilippe De Muyter /*
29a322993SPhilippe De Muyter * Private header for the MPC52xx processor BestComm driver
39a322993SPhilippe De Muyter *
49a322993SPhilippe De Muyter * By private, we mean that driver should not use it directly. It's meant
59a322993SPhilippe De Muyter * to be used by the BestComm engine driver itself and by the intermediate
69a322993SPhilippe De Muyter * layer between the core and the drivers.
79a322993SPhilippe De Muyter *
89a322993SPhilippe De Muyter * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
99a322993SPhilippe De Muyter * Copyright (C) 2005 Varma Electronics Oy,
109a322993SPhilippe De Muyter * ( by Andrey Volkov <avolkov@varma-el.com> )
119a322993SPhilippe De Muyter * Copyright (C) 2003-2004 MontaVista, Software, Inc.
129a322993SPhilippe De Muyter * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
139a322993SPhilippe De Muyter *
149a322993SPhilippe De Muyter * This file is licensed under the terms of the GNU General Public License
159a322993SPhilippe De Muyter * version 2. This program is licensed "as is" without any warranty of any
169a322993SPhilippe De Muyter * kind, whether express or implied.
179a322993SPhilippe De Muyter */
189a322993SPhilippe De Muyter
199a322993SPhilippe De Muyter #ifndef __BESTCOMM_PRIV_H__
209a322993SPhilippe De Muyter #define __BESTCOMM_PRIV_H__
219a322993SPhilippe De Muyter
229a322993SPhilippe De Muyter #include <linux/spinlock.h>
239a322993SPhilippe De Muyter #include <linux/of.h>
249a322993SPhilippe De Muyter #include <asm/io.h>
259a322993SPhilippe De Muyter #include <asm/mpc52xx.h>
269a322993SPhilippe De Muyter
279a322993SPhilippe De Muyter #include "sram.h"
289a322993SPhilippe De Muyter
299a322993SPhilippe De Muyter
309a322993SPhilippe De Muyter /* ======================================================================== */
319a322993SPhilippe De Muyter /* Engine related stuff */
329a322993SPhilippe De Muyter /* ======================================================================== */
339a322993SPhilippe De Muyter
349a322993SPhilippe De Muyter /* Zones sizes and needed alignments */
359a322993SPhilippe De Muyter #define BCOM_MAX_TASKS 16
369a322993SPhilippe De Muyter #define BCOM_MAX_VAR 24
379a322993SPhilippe De Muyter #define BCOM_MAX_INC 8
389a322993SPhilippe De Muyter #define BCOM_MAX_FDT 64
399a322993SPhilippe De Muyter #define BCOM_MAX_CTX 20
409a322993SPhilippe De Muyter #define BCOM_CTX_SIZE (BCOM_MAX_CTX * sizeof(u32))
419a322993SPhilippe De Muyter #define BCOM_CTX_ALIGN 0x100
429a322993SPhilippe De Muyter #define BCOM_VAR_SIZE (BCOM_MAX_VAR * sizeof(u32))
439a322993SPhilippe De Muyter #define BCOM_INC_SIZE (BCOM_MAX_INC * sizeof(u32))
449a322993SPhilippe De Muyter #define BCOM_VAR_ALIGN 0x80
459a322993SPhilippe De Muyter #define BCOM_FDT_SIZE (BCOM_MAX_FDT * sizeof(u32))
469a322993SPhilippe De Muyter #define BCOM_FDT_ALIGN 0x100
479a322993SPhilippe De Muyter
489a322993SPhilippe De Muyter /**
499a322993SPhilippe De Muyter * struct bcom_tdt - Task Descriptor Table Entry
509a322993SPhilippe De Muyter *
519a322993SPhilippe De Muyter */
529a322993SPhilippe De Muyter struct bcom_tdt {
539a322993SPhilippe De Muyter u32 start;
549a322993SPhilippe De Muyter u32 stop;
559a322993SPhilippe De Muyter u32 var;
569a322993SPhilippe De Muyter u32 fdt;
579a322993SPhilippe De Muyter u32 exec_status; /* used internally by BestComm engine */
589a322993SPhilippe De Muyter u32 mvtp; /* used internally by BestComm engine */
599a322993SPhilippe De Muyter u32 context;
609a322993SPhilippe De Muyter u32 litbase;
619a322993SPhilippe De Muyter };
629a322993SPhilippe De Muyter
639a322993SPhilippe De Muyter /**
649a322993SPhilippe De Muyter * struct bcom_engine
659a322993SPhilippe De Muyter *
669a322993SPhilippe De Muyter * This holds all info needed globaly to handle the engine
679a322993SPhilippe De Muyter */
689a322993SPhilippe De Muyter struct bcom_engine {
699a322993SPhilippe De Muyter struct device_node *ofnode;
709a322993SPhilippe De Muyter struct mpc52xx_sdma __iomem *regs;
719a322993SPhilippe De Muyter phys_addr_t regs_base;
729a322993SPhilippe De Muyter
739a322993SPhilippe De Muyter struct bcom_tdt *tdt;
749a322993SPhilippe De Muyter u32 *ctx;
759a322993SPhilippe De Muyter u32 *var;
769a322993SPhilippe De Muyter u32 *fdt;
779a322993SPhilippe De Muyter
789a322993SPhilippe De Muyter spinlock_t lock;
799a322993SPhilippe De Muyter };
809a322993SPhilippe De Muyter
819a322993SPhilippe De Muyter extern struct bcom_engine *bcom_eng;
829a322993SPhilippe De Muyter
839a322993SPhilippe De Muyter
849a322993SPhilippe De Muyter /* ======================================================================== */
859a322993SPhilippe De Muyter /* Tasks related stuff */
869a322993SPhilippe De Muyter /* ======================================================================== */
879a322993SPhilippe De Muyter
889a322993SPhilippe De Muyter /* Tasks image header */
899a322993SPhilippe De Muyter #define BCOM_TASK_MAGIC 0x4243544B /* 'BCTK' */
909a322993SPhilippe De Muyter
919a322993SPhilippe De Muyter struct bcom_task_header {
929a322993SPhilippe De Muyter u32 magic;
939a322993SPhilippe De Muyter u8 desc_size; /* the size fields */
949a322993SPhilippe De Muyter u8 var_size; /* are given in number */
959a322993SPhilippe De Muyter u8 inc_size; /* of 32-bits words */
969a322993SPhilippe De Muyter u8 first_var;
979a322993SPhilippe De Muyter u8 reserved[8];
989a322993SPhilippe De Muyter };
999a322993SPhilippe De Muyter
1009a322993SPhilippe De Muyter /* Descriptors structure & co */
1019a322993SPhilippe De Muyter #define BCOM_DESC_NOP 0x000001f8
1029a322993SPhilippe De Muyter #define BCOM_LCD_MASK 0x80000000
1039a322993SPhilippe De Muyter #define BCOM_DRD_EXTENDED 0x40000000
1049a322993SPhilippe De Muyter #define BCOM_DRD_INITIATOR_SHIFT 21
1059a322993SPhilippe De Muyter
1069a322993SPhilippe De Muyter /* Tasks pragma */
1079a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_RSV 7 /* reserved pragma bit */
1089a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_PRECISE_INC 6 /* increment 0=when possible, */
1099a322993SPhilippe De Muyter /* 1=iter end */
1109a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_RST_ERROR_NO 5 /* don't reset errors on */
1119a322993SPhilippe De Muyter /* task enable */
1129a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_PACK 4 /* pack data enable */
1139a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_INTEGER 3 /* data alignment */
1149a322993SPhilippe De Muyter /* 0=frac(msb), 1=int(lsb) */
1159a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_SPECREAD 2 /* XLB speculative read */
1169a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_CW 1 /* write line buffer enable */
1179a322993SPhilippe De Muyter #define BCOM_PRAGMA_BIT_RL 0 /* read line buffer enable */
1189a322993SPhilippe De Muyter
1199a322993SPhilippe De Muyter /* Looks like XLB speculative read generates XLB errors when a buffer
1209a322993SPhilippe De Muyter * is at the end of the physical memory. i.e. when accessing the
1219a322993SPhilippe De Muyter * lasts words, the engine tries to prefetch the next but there is no
1229a322993SPhilippe De Muyter * next ...
1239a322993SPhilippe De Muyter */
1249a322993SPhilippe De Muyter #define BCOM_STD_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
1259a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
1269a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
1279a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_PACK) | \
1289a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_INTEGER) | \
1299a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
1309a322993SPhilippe De Muyter (1 << BCOM_PRAGMA_BIT_CW) | \
1319a322993SPhilippe De Muyter (1 << BCOM_PRAGMA_BIT_RL))
1329a322993SPhilippe De Muyter
1339a322993SPhilippe De Muyter #define BCOM_PCI_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
1349a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
1359a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
1369a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_PACK) | \
1379a322993SPhilippe De Muyter (1 << BCOM_PRAGMA_BIT_INTEGER) | \
1389a322993SPhilippe De Muyter (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
1399a322993SPhilippe De Muyter (1 << BCOM_PRAGMA_BIT_CW) | \
1409a322993SPhilippe De Muyter (1 << BCOM_PRAGMA_BIT_RL))
1419a322993SPhilippe De Muyter
1429a322993SPhilippe De Muyter #define BCOM_ATA_PRAGMA BCOM_STD_PRAGMA
1439a322993SPhilippe De Muyter #define BCOM_CRC16_DP_0_PRAGMA BCOM_STD_PRAGMA
1449a322993SPhilippe De Muyter #define BCOM_CRC16_DP_1_PRAGMA BCOM_STD_PRAGMA
1459a322993SPhilippe De Muyter #define BCOM_FEC_RX_BD_PRAGMA BCOM_STD_PRAGMA
1469a322993SPhilippe De Muyter #define BCOM_FEC_TX_BD_PRAGMA BCOM_STD_PRAGMA
1479a322993SPhilippe De Muyter #define BCOM_GEN_DP_0_PRAGMA BCOM_STD_PRAGMA
1489a322993SPhilippe De Muyter #define BCOM_GEN_DP_1_PRAGMA BCOM_STD_PRAGMA
1499a322993SPhilippe De Muyter #define BCOM_GEN_DP_2_PRAGMA BCOM_STD_PRAGMA
1509a322993SPhilippe De Muyter #define BCOM_GEN_DP_3_PRAGMA BCOM_STD_PRAGMA
1519a322993SPhilippe De Muyter #define BCOM_GEN_DP_BD_0_PRAGMA BCOM_STD_PRAGMA
1529a322993SPhilippe De Muyter #define BCOM_GEN_DP_BD_1_PRAGMA BCOM_STD_PRAGMA
1539a322993SPhilippe De Muyter #define BCOM_GEN_RX_BD_PRAGMA BCOM_STD_PRAGMA
1549a322993SPhilippe De Muyter #define BCOM_GEN_TX_BD_PRAGMA BCOM_STD_PRAGMA
1559a322993SPhilippe De Muyter #define BCOM_GEN_LPC_PRAGMA BCOM_STD_PRAGMA
1569a322993SPhilippe De Muyter #define BCOM_PCI_RX_PRAGMA BCOM_PCI_PRAGMA
1579a322993SPhilippe De Muyter #define BCOM_PCI_TX_PRAGMA BCOM_PCI_PRAGMA
1589a322993SPhilippe De Muyter
1599a322993SPhilippe De Muyter /* Initiators number */
1609a322993SPhilippe De Muyter #define BCOM_INITIATOR_ALWAYS 0
1619a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_0 1
1629a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_1 2
1639a322993SPhilippe De Muyter #define BCOM_INITIATOR_FEC_RX 3
1649a322993SPhilippe De Muyter #define BCOM_INITIATOR_FEC_TX 4
1659a322993SPhilippe De Muyter #define BCOM_INITIATOR_ATA_RX 5
1669a322993SPhilippe De Muyter #define BCOM_INITIATOR_ATA_TX 6
1679a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCPCI_RX 7
1689a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCPCI_TX 8
1699a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC3_RX 9
1709a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC3_TX 10
1719a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC2_RX 11
1729a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC2_TX 12
1739a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC1_RX 13
1749a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC1_TX 14
1759a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_2 15
1769a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCLPC 16
1779a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC5_RX 17
1789a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC5_TX 18
1799a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC4_RX 19
1809a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC4_TX 20
1819a322993SPhilippe De Muyter #define BCOM_INITIATOR_I2C2_RX 21
1829a322993SPhilippe De Muyter #define BCOM_INITIATOR_I2C2_TX 22
1839a322993SPhilippe De Muyter #define BCOM_INITIATOR_I2C1_RX 23
1849a322993SPhilippe De Muyter #define BCOM_INITIATOR_I2C1_TX 24
1859a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC6_RX 25
1869a322993SPhilippe De Muyter #define BCOM_INITIATOR_PSC6_TX 26
1879a322993SPhilippe De Muyter #define BCOM_INITIATOR_IRDA_RX 25
1889a322993SPhilippe De Muyter #define BCOM_INITIATOR_IRDA_TX 26
1899a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_3 27
1909a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_4 28
1919a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_5 29
1929a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_6 30
1939a322993SPhilippe De Muyter #define BCOM_INITIATOR_SCTMR_7 31
1949a322993SPhilippe De Muyter
1959a322993SPhilippe De Muyter /* Initiators priorities */
1969a322993SPhilippe De Muyter #define BCOM_IPR_ALWAYS 7
1979a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_0 2
1989a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_1 2
1999a322993SPhilippe De Muyter #define BCOM_IPR_FEC_RX 6
2009a322993SPhilippe De Muyter #define BCOM_IPR_FEC_TX 5
2019a322993SPhilippe De Muyter #define BCOM_IPR_ATA_RX 7
2029a322993SPhilippe De Muyter #define BCOM_IPR_ATA_TX 7
2039a322993SPhilippe De Muyter #define BCOM_IPR_SCPCI_RX 2
2049a322993SPhilippe De Muyter #define BCOM_IPR_SCPCI_TX 2
2059a322993SPhilippe De Muyter #define BCOM_IPR_PSC3_RX 2
2069a322993SPhilippe De Muyter #define BCOM_IPR_PSC3_TX 2
2079a322993SPhilippe De Muyter #define BCOM_IPR_PSC2_RX 2
2089a322993SPhilippe De Muyter #define BCOM_IPR_PSC2_TX 2
2099a322993SPhilippe De Muyter #define BCOM_IPR_PSC1_RX 2
2109a322993SPhilippe De Muyter #define BCOM_IPR_PSC1_TX 2
2119a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_2 2
2129a322993SPhilippe De Muyter #define BCOM_IPR_SCLPC 2
2139a322993SPhilippe De Muyter #define BCOM_IPR_PSC5_RX 2
2149a322993SPhilippe De Muyter #define BCOM_IPR_PSC5_TX 2
2159a322993SPhilippe De Muyter #define BCOM_IPR_PSC4_RX 2
2169a322993SPhilippe De Muyter #define BCOM_IPR_PSC4_TX 2
2179a322993SPhilippe De Muyter #define BCOM_IPR_I2C2_RX 2
2189a322993SPhilippe De Muyter #define BCOM_IPR_I2C2_TX 2
2199a322993SPhilippe De Muyter #define BCOM_IPR_I2C1_RX 2
2209a322993SPhilippe De Muyter #define BCOM_IPR_I2C1_TX 2
2219a322993SPhilippe De Muyter #define BCOM_IPR_PSC6_RX 2
2229a322993SPhilippe De Muyter #define BCOM_IPR_PSC6_TX 2
2239a322993SPhilippe De Muyter #define BCOM_IPR_IRDA_RX 2
2249a322993SPhilippe De Muyter #define BCOM_IPR_IRDA_TX 2
2259a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_3 2
2269a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_4 2
2279a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_5 2
2289a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_6 2
2299a322993SPhilippe De Muyter #define BCOM_IPR_SCTMR_7 2
2309a322993SPhilippe De Muyter
2319a322993SPhilippe De Muyter
2329a322993SPhilippe De Muyter /* ======================================================================== */
2339a322993SPhilippe De Muyter /* API */
2349a322993SPhilippe De Muyter /* ======================================================================== */
2359a322993SPhilippe De Muyter
2369a322993SPhilippe De Muyter extern struct bcom_task *bcom_task_alloc(int bd_count, int bd_size, int priv_size);
2379a322993SPhilippe De Muyter extern void bcom_task_free(struct bcom_task *tsk);
2389a322993SPhilippe De Muyter extern int bcom_load_image(int task, u32 *task_image);
2399a322993SPhilippe De Muyter extern void bcom_set_initiator(int task, int initiator);
2409a322993SPhilippe De Muyter
2419a322993SPhilippe De Muyter
2429a322993SPhilippe De Muyter #define TASK_ENABLE 0x8000
2439a322993SPhilippe De Muyter
2449a322993SPhilippe De Muyter /**
2459a322993SPhilippe De Muyter * bcom_disable_prefetch - Hook to disable bus prefetching
2469a322993SPhilippe De Muyter *
2479a322993SPhilippe De Muyter * ATA DMA and the original MPC5200 need this due to silicon bugs. At the
2489a322993SPhilippe De Muyter * moment disabling prefetch is a one-way street. There is no mechanism
2499a322993SPhilippe De Muyter * in place to turn prefetch back on after it has been disabled. There is
2509a322993SPhilippe De Muyter * no reason it couldn't be done, it would just be more complex to implement.
2519a322993SPhilippe De Muyter */
bcom_disable_prefetch(void)2529a322993SPhilippe De Muyter static inline void bcom_disable_prefetch(void)
2539a322993SPhilippe De Muyter {
2549a322993SPhilippe De Muyter u16 regval;
2559a322993SPhilippe De Muyter
2569a322993SPhilippe De Muyter regval = in_be16(&bcom_eng->regs->PtdCntrl);
2579a322993SPhilippe De Muyter out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
2589a322993SPhilippe De Muyter };
2599a322993SPhilippe De Muyter
2609a322993SPhilippe De Muyter static inline void
bcom_enable_task(int task)2619a322993SPhilippe De Muyter bcom_enable_task(int task)
2629a322993SPhilippe De Muyter {
2639a322993SPhilippe De Muyter u16 reg;
2649a322993SPhilippe De Muyter reg = in_be16(&bcom_eng->regs->tcr[task]);
2659a322993SPhilippe De Muyter out_be16(&bcom_eng->regs->tcr[task], reg | TASK_ENABLE);
2669a322993SPhilippe De Muyter }
2679a322993SPhilippe De Muyter
2689a322993SPhilippe De Muyter static inline void
bcom_disable_task(int task)2699a322993SPhilippe De Muyter bcom_disable_task(int task)
2709a322993SPhilippe De Muyter {
2719a322993SPhilippe De Muyter u16 reg = in_be16(&bcom_eng->regs->tcr[task]);
2729a322993SPhilippe De Muyter out_be16(&bcom_eng->regs->tcr[task], reg & ~TASK_ENABLE);
2739a322993SPhilippe De Muyter }
2749a322993SPhilippe De Muyter
2759a322993SPhilippe De Muyter
2769a322993SPhilippe De Muyter static inline u32 *
bcom_task_desc(int task)2779a322993SPhilippe De Muyter bcom_task_desc(int task)
2789a322993SPhilippe De Muyter {
2799a322993SPhilippe De Muyter return bcom_sram_pa2va(bcom_eng->tdt[task].start);
2809a322993SPhilippe De Muyter }
2819a322993SPhilippe De Muyter
2829a322993SPhilippe De Muyter static inline int
bcom_task_num_descs(int task)2839a322993SPhilippe De Muyter bcom_task_num_descs(int task)
2849a322993SPhilippe De Muyter {
2859a322993SPhilippe De Muyter return (bcom_eng->tdt[task].stop - bcom_eng->tdt[task].start)/sizeof(u32) + 1;
2869a322993SPhilippe De Muyter }
2879a322993SPhilippe De Muyter
2889a322993SPhilippe De Muyter static inline u32 *
bcom_task_var(int task)2899a322993SPhilippe De Muyter bcom_task_var(int task)
2909a322993SPhilippe De Muyter {
2919a322993SPhilippe De Muyter return bcom_sram_pa2va(bcom_eng->tdt[task].var);
2929a322993SPhilippe De Muyter }
2939a322993SPhilippe De Muyter
2949a322993SPhilippe De Muyter static inline u32 *
bcom_task_inc(int task)2959a322993SPhilippe De Muyter bcom_task_inc(int task)
2969a322993SPhilippe De Muyter {
2979a322993SPhilippe De Muyter return &bcom_task_var(task)[BCOM_MAX_VAR];
2989a322993SPhilippe De Muyter }
2999a322993SPhilippe De Muyter
3009a322993SPhilippe De Muyter
3019a322993SPhilippe De Muyter static inline int
bcom_drd_is_extended(u32 desc)3029a322993SPhilippe De Muyter bcom_drd_is_extended(u32 desc)
3039a322993SPhilippe De Muyter {
3049a322993SPhilippe De Muyter return (desc) & BCOM_DRD_EXTENDED;
3059a322993SPhilippe De Muyter }
3069a322993SPhilippe De Muyter
3079a322993SPhilippe De Muyter static inline int
bcom_desc_is_drd(u32 desc)3089a322993SPhilippe De Muyter bcom_desc_is_drd(u32 desc)
3099a322993SPhilippe De Muyter {
3109a322993SPhilippe De Muyter return !(desc & BCOM_LCD_MASK) && desc != BCOM_DESC_NOP;
3119a322993SPhilippe De Muyter }
3129a322993SPhilippe De Muyter
3139a322993SPhilippe De Muyter static inline int
bcom_desc_initiator(u32 desc)3149a322993SPhilippe De Muyter bcom_desc_initiator(u32 desc)
3159a322993SPhilippe De Muyter {
3169a322993SPhilippe De Muyter return (desc >> BCOM_DRD_INITIATOR_SHIFT) & 0x1f;
3179a322993SPhilippe De Muyter }
3189a322993SPhilippe De Muyter
3199a322993SPhilippe De Muyter static inline void
bcom_set_desc_initiator(u32 * desc,int initiator)3209a322993SPhilippe De Muyter bcom_set_desc_initiator(u32 *desc, int initiator)
3219a322993SPhilippe De Muyter {
3229a322993SPhilippe De Muyter *desc = (*desc & ~(0x1f << BCOM_DRD_INITIATOR_SHIFT)) |
3239a322993SPhilippe De Muyter ((initiator & 0x1f) << BCOM_DRD_INITIATOR_SHIFT);
3249a322993SPhilippe De Muyter }
3259a322993SPhilippe De Muyter
3269a322993SPhilippe De Muyter
3279a322993SPhilippe De Muyter static inline void
bcom_set_task_pragma(int task,int pragma)3289a322993SPhilippe De Muyter bcom_set_task_pragma(int task, int pragma)
3299a322993SPhilippe De Muyter {
3309a322993SPhilippe De Muyter u32 *fdt = &bcom_eng->tdt[task].fdt;
3319a322993SPhilippe De Muyter *fdt = (*fdt & ~0xff) | pragma;
3329a322993SPhilippe De Muyter }
3339a322993SPhilippe De Muyter
3349a322993SPhilippe De Muyter static inline void
bcom_set_task_auto_start(int task,int next_task)3359a322993SPhilippe De Muyter bcom_set_task_auto_start(int task, int next_task)
3369a322993SPhilippe De Muyter {
3379a322993SPhilippe De Muyter u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
3389a322993SPhilippe De Muyter out_be16(tcr, (in_be16(tcr) & ~0xff) | 0x00c0 | next_task);
3399a322993SPhilippe De Muyter }
3409a322993SPhilippe De Muyter
3419a322993SPhilippe De Muyter static inline void
bcom_set_tcr_initiator(int task,int initiator)3429a322993SPhilippe De Muyter bcom_set_tcr_initiator(int task, int initiator)
3439a322993SPhilippe De Muyter {
3449a322993SPhilippe De Muyter u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
3459a322993SPhilippe De Muyter out_be16(tcr, (in_be16(tcr) & ~0x1f00) | ((initiator & 0x1f) << 8));
3469a322993SPhilippe De Muyter }
3479a322993SPhilippe De Muyter
3489a322993SPhilippe De Muyter
3499a322993SPhilippe De Muyter #endif /* __BESTCOMM_PRIV_H__ */
3509a322993SPhilippe De Muyter
351