diff options
Diffstat (limited to 'package')
50 files changed, 289 insertions, 4005 deletions
diff --git a/package/lqtapi/Makefile b/package/lqtapi/Makefile deleted file mode 100644 index 2ae07d1db..000000000 --- a/package/lqtapi/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# Copyright (C) 2006-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -PKG_NAME:=lqtapi -PKG_VERSION:=1 -PKG_RELEASE:=1 - -FW_SOURCE:=danube_firmware.bin -FW_URL:=http://www.arcor.de/hilfe/files/pdf/ -FW_FILE=arcor_A800_452CPW_FW_1.02.206(20081201).bin -FW_MD5SUM:=19d9af4e369287a0f0abaed415cdac10 - -include $(INCLUDE_DIR)/package.mk - -define Download/firmware - FILE:=$(FW_FILE) - URL:=$(FW_URL) - MD5SUM:=$(FW_MD5SUM) -endef -$(eval $(call Download,firmware)) - -define KernelPackage/lqtapi - SUBMENU:=Voice over IP - TITLE:=Tapi drivers for Lantiq SoC - DEPENDS:=@TARGET_lantiq_xway @BROKEN - FILES:=$(PKG_BUILD_DIR)/tapi/tapi.ko \ - $(PKG_BUILD_DIR)/mps/mps.ko \ - $(PKG_BUILD_DIR)/mps/vmmc.ko - AUTOLOAD:=$(call AutoLoad,80,tapi) \ - $(call AutoLoad,81,mps) -endef - -define Package/lqtapi-firmware-danube - SECTION:=sys - CATEGORY:=Kernel modules - SUBMENU:=Voice over IP - TITLE:=Danube firmware - DEPENDS:=+kmod-lqtapi -endef - -include $(INCLUDE_DIR)/kernel-defaults.mk - -define KernelPackage/lqtapi/description - FOSS drivers for Lantiq SoC voip core -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) - $(CP) src/* $(PKG_BUILD_DIR)/ -endef - -define Build/Compile - $(MAKE) $(KERNEL_MAKEOPTS) \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS=-I$(PKG_BUILD_DIR)/include/ \ - modules -endef - -define Package/lqtapi-firmware-danube/install - $(TOPDIR)/target/linux/$(BOARD)/extract.sh $(DL_DIR) '$(FW_FILE)' - $(INSTALL_DIR) $(1)/lib/firmware/ - $(INSTALL_DATA) $(DL_DIR)/voip.bin $(1)/lib/firmware/$(FW_SOURCE) -endef - -$(eval $(call KernelPackage,lqtapi)) -$(eval $(call BuildPackage,lqtapi-firmware-danube)) diff --git a/package/lqtapi/src/Makefile b/package/lqtapi/src/Makefile deleted file mode 100644 index 852accb6a..000000000 --- a/package/lqtapi/src/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-m = tapi/ mps/ diff --git a/package/lqtapi/src/include/linux/tapi/tapi-event.h b/package/lqtapi/src/include/linux/tapi/tapi-event.h deleted file mode 100644 index 925c71369..000000000 --- a/package/lqtapi/src/include/linux/tapi/tapi-event.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __LINUX_TAPI_TAPI_EVENT_H__ -#define __LINUX_TAPI_TAPI_EVENT_H__ - - -struct tapi_device; -struct tapi_port; - -struct tapi_hook_event { - bool on; -}; - -struct tapi_dtmf_event { - unsigned char code; -}; - -enum tapi_event_type { - TAPI_EVENT_TYPE_HOOK, - TAPI_EVENT_TYPE_DTMF, -}; - -struct tapi_event { - struct timeval time; - enum tapi_event_type type; - unsigned int port; - union { - struct tapi_hook_event hook; - struct tapi_dtmf_event dtmf; - }; -}; - -void tapi_report_event(struct tapi_device *tdev, struct tapi_event *event); -void tapi_report_hook_event(struct tapi_device *tdev, struct tapi_port *port, - bool on); -void tapi_report_dtmf_event(struct tapi_device *tdev, struct tapi_port *port, - unsigned char code); - -#endif diff --git a/package/lqtapi/src/include/linux/tapi/tapi-ioctl.h b/package/lqtapi/src/include/linux/tapi/tapi-ioctl.h deleted file mode 100644 index c43fac1e7..000000000 --- a/package/lqtapi/src/include/linux/tapi/tapi-ioctl.h +++ /dev/null @@ -1,20 +0,0 @@ - -#include <linux/ioctl.h> - -#define TAPI_MAGIC 't' -#define TAPI_IOCTL(x) _IO(TAPI_MAGIC, (x)) - -#define TAPI_CONTROL_IOCTL_LINK_ALLOC TAPI_IOCTL(0) -#define TAPI_CONTROL_IOCTL_LINK_FREE TAPI_IOCTL(1) -#define TAPI_CONTROL_IOCTL_LINK_ENABLE TAPI_IOCTL(2) -#define TAPI_CONTROL_IOCTL_LINK_DISABLE TAPI_IOCTL(3) - -#define TAPI_CONTROL_IOCTL_SYNC TAPI_IOCTL(4) - -#define TAPI_PORT_IOCTL_GET_ENDPOINT TAPI_IOCTL(5) -#define TAPI_PORT_IOCTL_SET_RING TAPI_IOCTL(6) - -#define TAPI_STREAM_IOCTL_GET_ENDPOINT TAPI_IOCTL(7) -#define TAPI_STREAM_IOCTL_CONFIGURE TAPI_IOCTL(8) -#define TAPI_STREAM_IOCTL_START TAPI_IOCTL(9) -#define TAPI_STREAM_IOCTL_STOP TAPI_IOCTL(10) diff --git a/package/lqtapi/src/include/linux/tapi/tapi.h b/package/lqtapi/src/include/linux/tapi/tapi.h deleted file mode 100644 index 410655d4c..000000000 --- a/package/lqtapi/src/include/linux/tapi/tapi.h +++ /dev/null @@ -1,231 +0,0 @@ -#ifndef __LINUX_TAPI_H__ -#define __LINUX_TAPI_H__ - -#include <linux/kernel.h> -#include <linux/device.h> -#include <linux/mutex.h> - -#include <linux/input.h> - -#include <asm/atomic.h> -#include <linux/list.h> - -#include <linux/cdev.h> - -#include <linux/skbuff.h> -#include <linux/wait.h> - -#include <linux/tapi/tapi-event.h> - -struct tapi_device; - -struct tapi_char_device { - struct tapi_device *tdev; - struct device dev; - struct cdev cdev; -}; - -static inline struct tapi_char_device *cdev_to_tapi_char_device(struct cdev *cdev) -{ - return container_of(cdev, struct tapi_char_device, cdev); -} - -int tapi_char_device_register(struct tapi_device *tdev, - struct tapi_char_device *tchrdev, const struct file_operations *fops); - - -struct tapi_endpoint { - unsigned int id; - void *data; -}; - -static inline void tapi_endpoint_set_data(struct tapi_endpoint *ep, void *data) -{ - ep->data = data; -} - -static inline void *tapi_endpoint_get_data(struct tapi_endpoint *ep) -{ - return ep->data; -} - -struct tapi_port { - unsigned int id; - struct tapi_endpoint ep; - struct input_dev *input; - struct tapi_char_device chrdev; -}; - -struct tapi_stream { - unsigned int id; - struct list_head head; - struct tapi_endpoint ep; - - struct sk_buff_head recv_queue; - wait_queue_head_t recv_wait; - struct sk_buff_head send_queue; -}; - -struct tapi_link { - unsigned int id; - struct list_head head; -}; - -enum tapi_codec { - TAPI_CODEC_L16, -}; - -struct tapi_stream_config { - enum tapi_codec codec; - unsigned int buffer_size; -}; - -struct tapi_ops { - int (*send_dtmf_events)(struct tapi_device *, struct tapi_port *port, - struct tapi_dtmf_event *, size_t num_events, unsigned int dealy); - int (*send_dtmf_event)(struct tapi_device *, struct tapi_port *port, - struct tapi_dtmf_event *); - int (*ring)(struct tapi_device *, struct tapi_port *port, bool ring); - - struct tapi_stream *(*stream_alloc)(struct tapi_device *); - void (*stream_free)(struct tapi_device *, struct tapi_stream *); - int (*stream_configure)(struct tapi_device *, struct tapi_stream *, - struct tapi_stream_config *); - int (*stream_start)(struct tapi_device *, struct tapi_stream *); - int (*stream_stop)(struct tapi_device *, struct tapi_stream *); - int (*stream_send)(struct tapi_device *, struct tapi_stream *, - struct sk_buff *); - - struct tapi_link *(*link_alloc)(struct tapi_device *, - struct tapi_endpoint *ep1, struct tapi_endpoint *ep2); - void (*link_free)(struct tapi_device *, struct tapi_link *); - int (*link_enable)(struct tapi_device *, struct tapi_link *); - int (*link_disable)(struct tapi_device *, struct tapi_link *); - - int (*sync)(struct tapi_device *); -}; - -int tapi_stream_recv(struct tapi_device *, struct tapi_stream *, struct sk_buff *); - -struct tapi_device { - unsigned int id; - - const struct tapi_ops *ops; - unsigned int num_ports; - - struct device dev; - - struct mutex lock; - - struct tapi_port *ports; - struct list_head streams; - struct list_head links; - atomic_t stream_id; - atomic_t link_id; - - struct tapi_char_device stream_dev; - struct tapi_char_device control_dev; -}; - -static inline struct tapi_device *dev_to_tapi(struct device *dev) -{ - return container_of(dev, struct tapi_device, dev); -} - -static inline struct tapi_stream *tapi_stream_from_id(struct tapi_device *tdev, - unsigned int id) -{ - struct tapi_stream *stream; - - mutex_lock(&tdev->lock); - - list_for_each_entry(stream, &tdev->streams, head) { - if (stream->id == id) - goto out; - } - stream = NULL; - -out: - mutex_unlock(&tdev->lock); - return stream; -} - -struct tapi_link *tapi_link_alloc(struct tapi_device *, struct tapi_endpoint *, - struct tapi_endpoint *); -void tapi_link_free(struct tapi_device *, struct tapi_link *); - -struct tapi_stream *tapi_stream_alloc(struct tapi_device *tdev); -void tapi_stream_free(struct tapi_device *tdev, struct tapi_stream *stream); - -static inline int tapi_sync(struct tapi_device *tdev) -{ - if (!tdev->ops || !tdev->ops->sync) - return 0; - - return tdev->ops->sync(tdev); -} - -static inline int tapi_link_enable(struct tapi_device *tdev, - struct tapi_link *link) -{ - if (!tdev->ops || !tdev->ops->link_enable) - return 0; - - return tdev->ops->link_enable(tdev, link); -} - -static inline int tapi_link_disable(struct tapi_device *tdev, - struct tapi_link *link) -{ - if (!tdev->ops || !tdev->ops->link_disable) - return 0; - - return tdev->ops->link_disable(tdev, link); -} - -static inline int tapi_port_send_dtmf(struct tapi_device *tdev, - struct tapi_port *port, struct tapi_dtmf_event *dtmf) -{ - if (!tdev->ops || !tdev->ops->send_dtmf_event) - return -ENOSYS; - - return tdev->ops->send_dtmf_event(tdev, port, dtmf); -} - -static inline int tapi_port_set_ring(struct tapi_device *tdev, - struct tapi_port *port, bool ring) -{ - if (!tdev->ops || !tdev->ops->ring) - return -ENOSYS; - - return tdev->ops->ring(tdev, port, ring); -} - -static inline int tapi_stream_start(struct tapi_device *tdev, -struct tapi_stream *stream) -{ - if (!tdev->ops || !tdev->ops->stream_start) - return -ENOSYS; - - return tdev->ops->stream_start(tdev, stream); -} - -static inline int tapi_stream_stop(struct tapi_device *tdev, -struct tapi_stream *stream) -{ - if (!tdev->ops || !tdev->ops->stream_stop) - return -ENOSYS; - - return tdev->ops->stream_stop(tdev, stream); -} - -int tapi_device_register(struct tapi_device *tdev, const char *name, - struct device *parent); -void tapi_device_unregister(struct tapi_device *tdev); - -struct tapi_sysfs_port; - -struct tapi_sysfs_port *tapi_port_alloc(struct tapi_device *tdev, unsigned int id); -void tapi_port_delete(struct tapi_sysfs_port *); - -#endif diff --git a/package/lqtapi/src/mps/Makefile b/package/lqtapi/src/mps/Makefile deleted file mode 100644 index 201bccc28..000000000 --- a/package/lqtapi/src/mps/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - - -mps-objs := mps-core.o mps-irq.o mps-fifo.o -obj-m += mps.o - -vmmc-objs := vmmc-core.o vmmc-alm.o vmmc-module.o vmmc-link.o vmmc-port.o \ - vmmc-signal.o vmmc-stream.o vmmc-coder.o -obj-m += vmmc.o diff --git a/package/lqtapi/src/mps/mps-core.c b/package/lqtapi/src/mps/mps-core.c deleted file mode 100644 index 27f1c63eb..000000000 --- a/package/lqtapi/src/mps/mps-core.c +++ /dev/null @@ -1,238 +0,0 @@ -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/io.h> -#include <linux/platform_device.h> -#include <linux/slab.h> - -#include <ifxmips.h> -#include <ifxmips_cgu.h> - -#include <ifxmips_prom.h> -#include <ifxmips_irq.h> - -#include "mps.h" - -extern int mps_irq_init(struct mps *mps); -extern void mps_irq_exit(struct mps *mps); - -#define MPS_CPU0_BOOT_RVEC 0x1c0 -#define MPS_CPU0_BOOT_NVEC 0x1c4 -#define MPS_CPU0_BOOT_EVEC 0x1c8 -#define MPS_CPU0_CP0_STATUS 0x1cc -#define MPS_CPU0_CP0_EEPC 0x1d0 -#define MPS_CPU0_CP0_EPC 0x1d4 -#define MPS_CPU0_BOOT_SIZE 0x1d8 -#define MPS_CPU0_CFG_STAT 0x1dc -#define MPS_CPU1_BOOT_RVEC 0x1e0 -#define MPS_CPU1_BOOT_NVEC 0x1e4 -#define MPS_CPU1_BOOT_EVEC 0x1e8 -#define MPS_CPU1_CP0_STATUS 0x1ec -#define MPS_CPU1_CP0_EEPC 0x1f0 -#define MPS_CPU1_CP0_EPC 0x1f4 -#define MPS_CPU1_BOOT_SIZE 0x1f8 -#define MPS_CPU1_CFG_STAT 0x1fc - -static void mps_reset(void) -{ - ifxmips_w32(ifxmips_r32(IFXMIPS_RCU_RST) | IFXMIPS_RCU_RST_CPU1, - IFXMIPS_RCU_RST); - smp_wmb(); -} - -static void mps_release(void) -{ - uint32_t val; - val = ifxmips_r32(IFXMIPS_RCU_RST); - val |= 0x20000000; - val &= ~IFXMIPS_RCU_RST_CPU1; - ifxmips_w32(val, IFXMIPS_RCU_RST); - smp_wmb(); -} - -void mps_load_firmware(struct mps *mps, const void *data, size_t size, - enum mps_boot_config config) -{ - uint32_t cfg = 0; - uint32_t fw_size = size; - - if (config == MPS_BOOT_LEGACY) { - cfg = 0x00020000; - fw_size -= sizeof(uint32_t); - } else { - if(config == MPS_BOOT_ENCRYPTED) { - cfg = __raw_readl(mps->mbox_base + MPS_CPU1_CFG_STAT); - cfg |= 0x00700000; - } else { - printk("PANIC!\n"); - } - } - - mps_reset(); - - memcpy_toio(mps->cp1_base, data, size); - - __raw_writel(cfg, mps->mbox_base + MPS_CPU1_CFG_STAT); - __raw_writel(fw_size, mps->mbox_base + MPS_CPU1_BOOT_SIZE); - __raw_writel((uint32_t)mps->cp1_base, mps->mbox_base + MPS_CPU1_BOOT_RVEC); - - mps_release(); -} -EXPORT_SYMBOL_GPL(mps_load_firmware); - -void mps_configure_fifo(struct mps *mps, struct mps_fifo *fifo, - const struct mps_fifo_config *config) -{ - mps_fifo_init(fifo, mps->mbox_base + config->base, - mps->mbox_base + config->head_addr, - mps->mbox_base + config->tail_addr, - config->size); - - __raw_writel(config->size, mps->mbox_base + config->size_addr); - __raw_writel(mps->mbox_res->start + config->base, - mps->mbox_base + config->base_addr); -} -EXPORT_SYMBOL_GPL(mps_configure_fifo); - -void mps_configure_mailbox(struct mps *mps, struct mps_mailbox *mbox, - const struct mps_fifo_config *upstream_config, - const struct mps_fifo_config *downstream_config) -{ - mps_configure_fifo(mps, &mbox->upstream, upstream_config); - mps_configure_fifo(mps, &mbox->downstream, downstream_config); -} -EXPORT_SYMBOL_GPL(mps_configure_mailbox); - -static int __devinit mps_probe(struct platform_device *pdev) -{ - int ret; - struct mps *mps; - struct resource *res; - - mps = kzalloc(sizeof(*mps), GFP_KERNEL); - - if (!mps) - return -ENOMEM; - - mps->dev = &pdev->dev; - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem"); - if (!res) { - dev_err(&pdev->dev, "Failed to get mem resource"); - ret = -ENOENT; - goto err_free; - } - - res = request_mem_region(res->start, resource_size(res), - dev_name(&pdev->dev)); - - if (!res) { - dev_err(&pdev->dev, "Failed to request mem resource"); - ret = -EBUSY; - goto err_free; - } - - mps->base = ioremap_nocache(res->start, resource_size(res)); - - if (!mps->base) { - dev_err(&pdev->dev, "Failed to ioremap mem region\n"); - ret = -EBUSY; - goto err_release_mem_region; - } - - mps->res = res; - - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mailbox"); - if (!res) { - dev_err(&pdev->dev, "Failed to get mailbox mem region\n"); - ret = -ENOENT; - goto err_free; - } - - res = request_mem_region(res->start, resource_size(res), - dev_name(&pdev->dev)); - - if (!res) { - dev_err(&pdev->dev, "Failed to request mailbox mem region\n"); - ret = -EBUSY; - goto err_free; - } - - mps->mbox_base = ioremap_nocache(res->start, resource_size(res)); - - if (!mps->mbox_base) { - dev_err(&pdev->dev, "Failed to ioremap mailbox mem region\n"); - ret = -EBUSY; - goto err_release_mem_region; - } - - mps->mbox_res = res; - - mps->cp1_base = ioremap_nocache((unsigned int)pdev->dev.platform_data, 1 << 20); - - if (!mps->cp1_base) { - dev_err(&pdev->dev, "Failed to ioremap cp1 address\n"); - ret = -EBUSY; - goto err_release_mem_region; - } - - mps->irq_ad0 = INT_NUM_IM4_IRL18; - mps->irq_ad1 = INT_NUM_IM4_IRL19; - mps->irq_base = 160; - - ret = mps_irq_init(mps); - if (ret < 0) - goto err_iounmap; - - platform_set_drvdata(pdev, mps); - - return 0; - -err_iounmap: - iounmap(mps->mbox_base); -err_release_mem_region: - release_mem_region(res->start, resource_size(res)); -err_free: - kfree(mps); - - return ret; -} - -static int __devexit mps_remove(struct platform_device *pdev) -{ - struct mps *mps = platform_get_drvdata(pdev); - - mps_irq_exit(mps); - - iounmap(mps->mbox_base); - release_mem_region(mps->mbox_res->start, resource_size(mps->mbox_res)); - iounmap(mps->base); - release_mem_region(mps->res->start, resource_size(mps->res)); - - kfree(mps); - return 0; -} - -static struct platform_driver mps_driver = { - .probe = mps_probe, - .remove = __devexit_p(mps_remove), - .driver = { - .name = "mps", - .owner = THIS_MODULE - }, -}; - -static int __init mps_init(void) -{ - return platform_driver_register(&mps_driver); -} -module_init(mps_init); - -static void __exit mps_exit(void) -{ - platform_driver_unregister(&mps_driver); -} -module_exit(mps_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); diff --git a/package/lqtapi/src/mps/mps-fifo.c b/package/lqtapi/src/mps/mps-fifo.c deleted file mode 100644 index 9d88a4547..000000000 --- a/package/lqtapi/src/mps/mps-fifo.c +++ /dev/null @@ -1,102 +0,0 @@ -#include <linux/io.h> - -#include "mps.h" - -void mps_fifo_init(struct mps_fifo *fifo, void __iomem *base, - void __iomem *head_addr, void __iomem *tail_addr, uint32_t size) -{ - fifo->base = base; - fifo->head_addr = head_addr; - fifo->tail_addr = tail_addr; - fifo->size = size; - mps_fifo_reset(fifo); -} - -void mps_fifo_in(struct mps_fifo *fifo, const uint32_t *from, size_t len) -{ - uint32_t head = __raw_readl(fifo->head_addr); - void __iomem *base = fifo->base + head; - size_t i = 0; - size_t byte_len = len * 4; - - if (head < byte_len) { - for(; i <= head / 4; ++i) { - __raw_writel(from[i], base); - base -= 4; - } - - base += fifo->size; - head += fifo->size; - } - - for(; i < len; ++i) { - __raw_writel(from[i], base); - base -= 4; - } - - head -= byte_len; - __raw_writel(head, fifo->head_addr); - -} -EXPORT_SYMBOL_GPL(mps_fifo_in); - -void mps_fifo_out(struct mps_fifo *fifo, uint32_t *to, size_t len) -{ - uint32_t tail = __raw_readl(fifo->tail_addr); - void __iomem *base = fifo->base + tail; - size_t i = 0; - size_t byte_len = len * 4; - - if (tail < byte_len) { - for(; i <= tail / 4; ++i) { - to[i] = __raw_readl(base); - base -= 4; - } - - base += fifo->size; - tail += fifo->size; - } - - for(; i < len; ++i) { - to[i] = __raw_readl(base); - base -= 4; - } - - tail -= byte_len; - __raw_writel(tail, fifo->tail_addr); -} -EXPORT_SYMBOL_GPL(mps_fifo_out); - -uint32_t mps_fifo_peek(struct mps_fifo *fifo) -{ - uint32_t tail = __raw_readl(fifo->tail_addr); - void __iomem *base = fifo->base + tail; - return __raw_readl(base); -} - -void mps_fifo_reset(struct mps_fifo *fifo) -{ - void __iomem *base = fifo->base + fifo->size - 4; - size_t i; - - __raw_writel(fifo->size - 4, fifo->head_addr); - __raw_writel(fifo->size - 4, fifo->tail_addr); - - for(i = 0; i < 16; ++i) { - __raw_writel(0x0, base); - base -= 4; - } -} - -size_t mps_fifo_len(struct mps_fifo *fifo) -{ - uint32_t head = __raw_readl(fifo->head_addr); - uint32_t tail = __raw_readl(fifo->tail_addr); - - if (tail < head) - return head - tail; - else - return fifo->size - (tail - head); -} -EXPORT_SYMBOL_GPL(mps_fifo_len); - diff --git a/package/lqtapi/src/mps/mps-irq.c b/package/lqtapi/src/mps/mps-irq.c deleted file mode 100644 index 8da0c00c7..000000000 --- a/package/lqtapi/src/mps/mps-irq.c +++ /dev/null @@ -1,157 +0,0 @@ -#include <linux/interrupt.h> -#include <linux/kernel_stat.h> -#include <ifxmips_irq.h> - -#include "mps.h" -#include "mps-irq.h" - -#define MPS_REG_AD0_IRQ_BASE 0x40 -#define MPS_REG_AD1_IRQ_BASE 0x44 - -#define MPS_REG_AD_IRQ_STATUS 0x00 -#define MPS_REG_AD_IRQ_SET 0x08 -#define MPS_REG_AD_IRQ_CLEAR 0x10 -#define MPS_REG_AD_IRQ_ENABLE 0x18 - -struct mps_irq_desc -{ - void __iomem *base; - unsigned int irq_base; -}; - -static inline unsigned int mps_irq_bit(struct mps_irq_desc *mps_desc, int irq) -{ - return BIT(irq - mps_desc->irq_base); -} - -static void mps_irq_ack(unsigned int irq) -{ - struct mps_irq_desc *mps_desc = get_irq_chip_data(irq); - - __raw_writel(mps_irq_bit(mps_desc, irq), - mps_desc->base + MPS_REG_AD_IRQ_CLEAR); -} - -static void mps_irq_mask(unsigned int irq) -{ - struct mps_irq_desc *mps_desc = get_irq_chip_data(irq); - uint32_t mask; - - mask = __raw_readl(mps_desc->base + MPS_REG_AD_IRQ_ENABLE); - mask &= ~mps_irq_bit(mps_desc, irq); - __raw_writel(mask, mps_desc->base + MPS_REG_AD_IRQ_ENABLE); -} - -static void mps_irq_unmask(unsigned int irq) -{ - struct mps_irq_desc *mps_desc = get_irq_chip_data(irq); - uint32_t mask; - - mask = __raw_readl(mps_desc->base + MPS_REG_AD_IRQ_ENABLE); - mask |= mps_irq_bit(mps_desc, irq) | 0xffff; - __raw_writel(mask, mps_desc->base + MPS_REG_AD_IRQ_ENABLE); -} - -static struct irq_chip mps_irq_chip = { - .name = "mps", - .ack = mps_irq_ack, - .mask = mps_irq_mask, - .unmask = mps_irq_unmask, -}; - -static void mps_irq_demux_handler(unsigned int irq, struct irq_desc *desc) -{ - struct mps_irq_desc *mps_desc = get_irq_data(irq); - uint32_t val; - int mps_irq; - - desc->chip->mask(irq); - - val = __raw_readl(mps_desc->base + MPS_REG_AD_IRQ_STATUS); - mps_irq = ffs(val); - -/* printk("irq: %d %x\n", mps_irq, val);*/ - - if (mps_irq > 16) - printk("PANIC!\n"); - - if (mps_irq) - generic_handle_irq(mps_irq + mps_desc->irq_base - 1); - - desc->chip->ack(irq); - desc->chip->unmask(irq); -} - -#if 0 - -static const uint32_t ring_msg[] = { -0x01010004, 0x00030000, -}; - -static irqreturn_t mps_irq_ad0(int irq, void *devid) -{ - struct mps *mps = devid; - uint32_t val; - - val = __raw_readl(mps->base + MPS_REG_AD0_IRQ_STATUS); - printk("WOHO ein IRQ: %x\n", val); - __raw_writel(val, mps->base + MPS_REG_AD0_IRQ_CLEAR); - - if (val & BIT(MPS_IRQ_DOWNLOAD_DONE)) - complete(&mps->init_completion); - - if (val & BIT(MPS_IRQ_EVENT)) - mps_fifo_in(&mps->mbox_cmd.downstream, ring_msg, ARRAY_SIZE(ring_msg)); - - return IRQ_HANDLED; -} -#endif - -#define MPS_NUM_AD_IRQS 32 - -struct mps_irq_desc mps_irq_descs[2]; - -int mps_irq_init(struct mps *mps) -{ - int ret = 0; - int irq; - - mps_irq_descs[0].base = mps->base + MPS_REG_AD0_IRQ_BASE; - mps_irq_descs[0].irq_base = mps->irq_base; - mps_irq_descs[1].base = mps->base + MPS_REG_AD1_IRQ_BASE; - mps_irq_descs[1].irq_base = mps->irq_base + 16; - - - set_irq_data(mps->irq_ad0, &mps_irq_descs[0]); - set_irq_chained_handler(mps->irq_ad0, mps_irq_demux_handler); - set_irq_data(mps->irq_ad1, &mps_irq_descs[1]); - set_irq_chained_handler(mps->irq_ad1, mps_irq_demux_handler); - -/* - ret = request_irq(mps->irq_ad0, mps_irq_demux_handler, IRQF_DISABLED, - "mps ad0", &mps_irq_descs[0]); - ret = request_irq(mps->irq_ad1, mps_irq_demux_handler, IRQF_DISABLED, - "mps ad0", &mps_irq_descs[1]); -*/ - for (irq = 0; irq < MPS_NUM_AD_IRQS; ++irq) { - set_irq_chip_data(irq + mps->irq_base, &mps_irq_descs[irq / 16]); - set_irq_chip_and_handler(irq + mps->irq_base, &mps_irq_chip, handle_level_irq); - } - - -/* - res = request_irq(INT_NUM_IM4_IRL18, mps_irq_ad0, IRQF_DISABLED, - "mps ad0", mps); - - irqs = BIT(MPS_IRQ_CMD_UPSTREAM) | BIT(MPS_IRQ_DATA_UPSTREAM) - | BIT(MPS_IRQ_DOWNLOAD_DONE) | BIT(MPS_IRQ_EVENT) | BIT(MPS_IRQ_CMD_ERROR); - - __raw_writel(irqs, mps->base + MPS_REG_AD0_IRQ_ENA); -*/ - return ret; -} - -void mps_irq_exit(struct mps *mps) -{ - free_irq(INT_NUM_IM4_IRL18, mps); -} diff --git a/package/lqtapi/src/mps/mps-irq.h b/package/lqtapi/src/mps/mps-irq.h deleted file mode 100644 index c343ace3f..000000000 --- a/package/lqtapi/src/mps/mps-irq.h +++ /dev/null @@ -1,18 +0,0 @@ - -#define MPS_IRQ_BASE 160 -#define MPS_IRQ(x) (MPS_IRQ_BASE + (x)) -#define MPS_IRQ_CMD_UPSTREAM MPS_IRQ(0) -#define MPS_IRQ_DATA_UPSTREAM MPS_IRQ(1) -#define MPS_IRQ_CMD_DOWNSTREAM MPS_IRQ(2) -#define MPS_IRQ_DATA_DOWNSTREAM MPS_IRQ(3) -#define MPS_IRQ_RCV_OVERFLOW MPS_IRQ(4) -#define MPS_IRQ_EVENT MPS_IRQ(5) -#define MPS_IRQ_EVENT_OVERFLOW MPS_IRQ(6) -#define MPS_IRQ_CMD_ERROR MPS_IRQ(8) -#define MPS_IRQ_PCM_CRASH MPS_IRQ(9) -#define MPS_IRQ_DATA_ERROR MPS_IRQ(10) -#define MPS_IRQ_MIPS_OL MPS_IRQ(11) -#define MPS_IRQ_WATCHDOG_FAIL MPS_IRQ(14) -#define MPS_IRQ_DOWNLOAD_DONE MPS_IRQ(15) - - diff --git a/package/lqtapi/src/mps/mps-msg.c b/package/lqtapi/src/mps/mps-msg.c deleted file mode 100644 index 7fc0b7a99..000000000 --- a/package/lqtapi/src/mps/mps-msg.c +++ /dev/null @@ -1,19 +0,0 @@ - - -int mps_message_send(struct mps_fifo *fifo, struct mps_message *msg) -{ -} - -int mps_message_recv(struct mps_fifo *fifo, struct mps_message *msg) -{ - mps_fifo_out(fifo, &msg->header, sizeof(msg->header)); - mps_fifo_out(fifo, &msg->data, mps_message_size(msg)); -} - -struct mps_message *msg mps_message_recv_alloc(struct mps_fifo *fifo) -{ - struct mps_message *msg; - - mps_fifo_out(fifo, &msg->header, sizeof(msg->header)); - mps_fifo_out(fifo, &msg->data, mps_message_size(msg)); -} diff --git a/package/lqtapi/src/mps/mps-msg.h b/package/lqtapi/src/mps/mps-msg.h deleted file mode 100644 index 8d672fbf5..000000000 --- a/package/lqtapi/src/mps/mps-msg.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __MPS_MSG_H__ -#define __MPS_MSG_H__ - -#include <linux/slab.h> - -struct mps_message { - uint32_t header; - uint32_t data[0]; -}; - -#define MPS_MSG_HEADER(_rw, _sc, _bc, _cmd, _chan, _mode, _ecmd, _length) \ - (((_rw) << 31) | ((_sc) << 30) | ((_bc) << 29) | ((_cmd) << 24) | \ - ((_chan) << 16) | ((_mode) << 13) | ((_ecmd) << 8) | (_length)) - -#define MPS_MSG_INIT(_msg, _rw, _sc, _bc, _cmd, _chan, _mode, _ecmd, _length) \ - do { \ - (_msg)->header = MPS_MSG_HEADER(_rw, _sc, _bc, _cmd, _chan, _mode, \ - _ecmd, _length); \ - } while(0) - - -static inline void mps_msg_init(struct mps_message *msg, uint32_t rw, uint32_t sc, - uint32_t bc, uint32_t cmd, uint32_t chan, uint32_t mode, uint32_t ecmd, - uint32_t length) -{ - msg->header = MPS_MSG_HEADER(rw, sc, bc, cmd, chan, mode, ecmd, length); -} - -#define DECLARE_MESSAGE(_name, _size) struct mps_message _name; \ - uint32_t __mps_msg_data_ ## __FUNCTION__ ## __LINE__[_size] - -static inline struct mps_message *mps_message_alloc(size_t size) -{ - return kmalloc(sizeof(struct mps_message) + size * sizeof(uint32_t), GFP_KERNEL); -} - -static inline size_t mps_message_size(const struct mps_message *msg) -{ - return msg->header & 0xff; -} - -enum { - MPS_MSG_WRITE = 0, - MPS_MSG_READ = 1, -}; - -enum { - MPS_CMD_ALI = 1, - MPS_CMD_DECT = 3, - MPS_CMD_SDD = 4, - MPS_CMD_EOP = 6, -}; - -#define MOD_PCM 0 -#define MOD_SDD 0 -#define MOD_ALI 1 -#define MOD_SIGNALING 2 -#define MOD_CODER 3 -#define MOD_RESOURCE 6 -#define MOD_SYSTEM 7 -#define ECMD_SYS_VER 6 -#define SYS_CAP_ECMD 7 -#define ECMD_CIDS_DATA 9 -#define ECMD_DCCTL_DEBUG 0x0a - -#define ALI_CHAN_CMD 6 -#define ALI_CHAN_ECMD 1 - -#define MPS_MSG_HEADER_W(_sc, _bc, _cmd, _chan, _mode, _ecmd, _length) \ - MPS_MSG_HEADER(MPS_MSG_WRITE, _sc, _bc, _cmd, _chan, _mode, _ecmd, _length) - -#define MPS_MSG_HEADER_R(_sc, _bc, _cmd, _chan, _mode, _ecmd, _length) \ - MPS_MSG_HEADER(MPS_MSG_READ, _sc, _bc, _cmd, _chan, _mode, _ecmd, _length) - -#define MPS_MSG_CMD_EOP(_mode, _ecmd, _length) \ - MPS_MSG_HEADER_R(0, 0, MPS_CMD_EOP, 0, _mode, _ecmd, _length) - -#define MPS_MSG_CMD_EOP_SYSTEM(_ecmd, _length) \ - MPS_MSG_CMD_EOP(MOD_SYSTEM, _ecmd, _length) - -#define MPS_CMD_GET_VERSION \ - MPS_MSG_CMD_EOP_SYSTEM(ECMD_SYS_VER, 4) - -#define MPS_CMD_ALI(_chan) \ - MPS_MSG_HEADER_W(0, 0, ALI_CHAN_CMD, _chan, MOD_ALI, ALI_CHAN_ECMD, 12) - -#endif diff --git a/package/lqtapi/src/mps/mps.h b/package/lqtapi/src/mps/mps.h deleted file mode 100644 index e759e5698..000000000 --- a/package/lqtapi/src/mps/mps.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __MPS_H__ -#define __MPS_H__ - -#include <linux/platform_device.h> -#include <linux/completion.h> - -struct mps_fifo_config -{ - size_t head_addr; - size_t tail_addr; - size_t base_addr; - size_t size_addr; - - size_t base; - size_t size; -}; - -struct mps_fifo { - void __iomem *base; - void __iomem *head_addr; - void __iomem *tail_addr; - uint32_t size; -}; - -struct mps_mailbox { - struct mps_fifo upstream; - struct mps_fifo downstream; -}; - -enum mps_boot_config -{ - MPS_BOOT_LEGACY = 1, - MPS_BOOT_ENCRYPTED = 2, -}; - -struct mps { - struct resource *res; - void __iomem *base; - - struct resource *mbox_res; - void __iomem *mbox_base; - - struct resource *cp1_res; - void __iomem *cp1_base; - - struct device *dev; - - int irq_ad0; - int irq_ad1; - int irq_base; -}; - -void mps_configure_fifo(struct mps *mps, struct mps_fifo *fifo, - const struct mps_fifo_config *config); - -void mps_configure_mailbox(struct mps *mps, struct mps_mailbox *mbox, - const struct mps_fifo_config *upstream_config, - const struct mps_fifo_config *downstream_config); - -void mps_load_firmware(struct mps *mps, const void *data, size_t size, - enum mps_boot_config config); - -static inline struct mps *device_to_mps(struct device *dev) -{ - return (struct mps *)dev_get_drvdata(dev); -} - -/* fifo */ -void mps_fifo_init(struct mps_fifo *fifo, void __iomem *data_addr, - void __iomem *head_addr, void __iomem *tail_addr, uint32_t size); -void mps_fifo_in(struct mps_fifo *fifo, const uint32_t *from, size_t len); -void mps_fifo_out(struct mps_fifo *fifo, uint32_t *to, size_t len); -uint32_t mps_fifo_peek(struct mps_fifo *fifo); -void mps_fifo_reset(struct mps_fifo *fifo); -size_t mps_fifo_len(struct mps_fifo *fifo); - -/* Mailbox */ -int mps_mailbox_init(struct mps_mailbox *mbox, const char *name, int irq); -int mps_mailbox_command_read(struct mps_mailbox *mbox, uint32_t cmd, - uint32_t *result); -int mps_mailbox_command_write(struct mps_mailbox *mbox, uint32_t cmd, - const uint32_t *data); - - -#endif diff --git a/package/lqtapi/src/mps/vmmc-alm.c b/package/lqtapi/src/mps/vmmc-alm.c deleted file mode 100644 index 828376fb9..000000000 --- a/package/lqtapi/src/mps/vmmc-alm.c +++ /dev/null @@ -1,129 +0,0 @@ -#include <linux/kernel.h> - -#include "vmmc.h" -#include "vmmc-cmds.h" -#include "vmmc-alm.h" -#include "vmmc-module.h" -#include "mps.h" - -static inline struct vmmc_alm *vmmc_module_to_alm(struct vmmc_module *module) -{ - return container_of(module, struct vmmc_alm, module); -} - -int vmmc_alm_set_state(struct vmmc_alm *alm, enum vmmc_alm_state state) -{ - int ret; - - ret = vmmc_command_write(alm->vmmc, VMMC_CMD_OPMODE(alm->id), &state); - if (!ret) - alm->state = state; - - return ret; -} - -enum vmmc_alm_state vmmc_alm_get_state(struct vmmc_alm *alm) -{ - return alm->state; -} - -static struct vmmc_alm_coef *vmmc_alm_coef_alloc(unsigned int offset, size_t len) -{ - struct vmmc_alm_coef *coef; - - coef = kzalloc(sizeof(*coef) + sizeof(uint32_t) * DIV_ROUND_UP(len, 4), - GFP_KERNEL); - coef->offset = offset; - coef->len = len; - - return coef; -} - -int vmcc_alm_set_coefficents(struct vmmc_alm *alm, - const struct vmmc_alm_coef *coef_list) -{ - int ret = 0; - uint32_t cmd; - struct vmmc_alm_coef *coef; - struct list_head l; - - INIT_LIST_HEAD(&l); - - coef = vmmc_alm_coef_alloc(0x37, 8); - coef->data[0] = 0x76d7871d; - coef->data[1] = 0x7fbb7ff4; - list_add_tail(&coef->list, &l); - coef = vmmc_alm_coef_alloc(0x5e, 2); - coef->data[0] = 0x7e000000; - list_add_tail(&coef->list, &l); - coef = vmmc_alm_coef_alloc(0x6c, 2); - coef->data[0] = 0x7e000000; - list_add_tail(&coef->list, &l); - - list_for_each_entry(coef, &l, list) { - cmd = VMMC_CMD_ALM_COEF(alm->id, coef->offset, coef->len); - ret = vmmc_command_write(alm->vmmc, cmd, coef->data); - if (ret) - break; - } - - return ret; -} - -static int vmmc_alm_sync(struct vmmc_module *module) -{ - struct vmmc_alm *alm = vmmc_module_to_alm(module); - - alm->cmd_cache[0] = VMMC_CMD_ALI_DATA1(1, 0, 0, 1, 0, module->pins[0], 0x4000); - alm->cmd_cache[1] = VMMC_CMD_ALI_DATA2(0x4000, module->pins[1], module->pins[2]); - alm->cmd_cache[2] = VMMC_CMD_ALI_DATA3(module->pins[3], module->pins[4]); - - return vmmc_command_write(alm->vmmc, VMMC_CMD_ALI(alm->id), alm->cmd_cache); -} - -static int vmmc_alm_enable(struct vmmc_module *module, bool enable) -{ - struct vmmc_alm *alm = vmmc_module_to_alm(module); - - return vmmc_command_write(alm->vmmc, VMMC_CMD_ALI(alm->id), alm->cmd_cache); -} - -static const struct vmmc_module_ops vmmc_alm_module_ops = { - .sync = vmmc_alm_sync, - .enable = vmmc_alm_enable, -}; - -int vmmc_alm_init(struct vmmc_alm *alm, struct vmmc *vmmc, unsigned int id) -{ - int ret; - - ret = vmmc_module_init(&alm->module, 5, &vmmc_alm_module_ops); - if (ret) - return ret; - - alm->id = id; - alm->module.id = id + 0x4; - alm->vmmc = vmmc; - - alm->cmd_cache[0] = VMMC_CMD_ALI_DATA1(1, 0, 0, 1, 0, 0, 0x2000); - alm->cmd_cache[1] = VMMC_CMD_ALI_DATA2(0x2000, 0, 0); - alm->cmd_cache[2] = VMMC_CMD_ALI_DATA3(0, 0); - - vmmc_command_write(alm->vmmc, VMMC_CMD_ALI(alm->id), alm->cmd_cache); - vmcc_alm_set_coefficents(alm, NULL); - vmmc_register_module(vmmc, &alm->module); - -// disable lec -// write lec coef -// write nlp coef -// enable lec - -// ALI_LEC ALI_ES RES_LEC_COEF RES_LEC_NLP_COEF - - return ret; -} - -void vmmc_alm_hook_event_handler(struct vmmc *vmmc, uint32_t id, uint32_t data) -{ - tapi_report_hook_event(&vmmc->tdev, &vmmc->tdev.ports[id], data & 1); -} diff --git a/package/lqtapi/src/mps/vmmc-alm.h b/package/lqtapi/src/mps/vmmc-alm.h deleted file mode 100644 index 4e59b6627..000000000 --- a/package/lqtapi/src/mps/vmmc-alm.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __VMMC_ALM_H__ -#define __VMMC_ALM_H__ - -#include "vmmc-module.h" - -struct vmmc; -enum vmmc_alm_state { - VMMC_ALM_STATE_OFF = 0 << 16, - VMMC_ALM_STATE_ONHOOK = 1 << 16, - VMMC_ALM_STATE_RING = 3 << 16, - VMMC_ALM_STATE_ACTIVE = 2 << 16, -}; - -struct vmmc_alm { - struct vmmc *vmmc; - unsigned int id; - - enum vmmc_alm_state state; - - struct vmmc_module module; - - uint32_t cmd_cache[3]; -}; - -struct vmmc_alm_coef { - struct list_head list; - unsigned int offset; - size_t len; - uint32_t data[0]; -}; - -int vmmc_alm_init(struct vmmc_alm *alm, struct vmmc *vmmc, unsigned int id); - -int vmmc_alm_set_state(struct vmmc_alm *alm, enum vmmc_alm_state state); -enum vmmc_alm_state vmmc_alm_get_state(struct vmmc_alm *alm); - -int vmcc_alm_set_coefficents(struct vmmc_alm *alm, - const struct vmmc_alm_coef *coef_list); - -void vmmc_alm_hook_event_handler(struct vmmc *vmmc, uint32_t event, uint32_t data); - -#endif diff --git a/package/lqtapi/src/mps/vmmc-cmds.h b/package/lqtapi/src/mps/vmmc-cmds.h deleted file mode 100644 index e833062c7..000000000 --- a/package/lqtapi/src/mps/vmmc-cmds.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __VMMC_CMDS_H__ -#define __VMMC_CMDS_H__ - -#define _VMMC_CMD(_x) ((_x) << 24) -#define _VMMC_MOD(_x) ((_x) << 13) -#define _VMMC_ECMD(_x) ((_x) << 8) - -#define _VMMC_MSG(_cmd, _mod, _ecmd) \ - (_VMMC_CMD(_cmd) | _VMMC_ECMD(_ecmd) | _VMMC_MOD(_mod)) - -#define _VMMC_CHAN(_chan) ((_chan) << 16) -#define _VMMC_LENGTH(_length) ((_length) << 2) - -#define VMMC_CMD_OPMODE(_chan) (_VMMC_MSG(1, 0, 0) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(1)) - -#define VMMC_CMD_SIG(_chan) (_VMMC_MSG(6, 2, 1) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(1)) -#define VMMC_CMD_SIG_DATA(_enable, _event, _rate, _i1, _i2, _mute1, _mute2) \ - (((_enable) << 31) | ((_event) << 30) | ((_i1) << 24) | ((_i2) << 16) | \ - ((_rate) << 23) | ((_mute1) << 15) | ((_mute2) << 14)) - -#define VMMC_CMD_SIG_SET_ENABLE(_data, _enable) (((_data) & ~BIT(31)) | ((_enable) << 31)) -#define VMMC_CMD_SIG_SET_INPUTS(_data, _i1, _i2) (((_data) & ~0x3f3f0000) | \ - ((_i1) << 24) | ((_i2) << 16)) - -#define VMMC_CMD_DTMFR(_chan) (_VMMC_MSG(6, 2, 4) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(1)) -#define VMMC_CMD_DTMFR_DATA(_enable, _event, _nr) \ - (((_enable) << 31) | ((_event) << 30) | (6 << 27) | ((_nr) << 16)) - -#define VMMC_CMD_CODER(_chan) (_VMMC_MSG(6, 3, 1) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(4)) - -#define VMMC_CMD_CODER_DATA1(_enable, _rate, _ns, _pte, _nr, _i1, _hp, _pf, \ - _cng, _bfi, _dec, _im, _pst, _sic, _em, _enc) \ - (((_enable) << 31) | ((_rate) << 30) | ((_ns) << 29) | ((_pte) << 26) | \ - ((_nr) << 22) | ((_i1) << 16) | ((_hp) << 15) | ((_pf) << 14) | \ - ((_cng) << 13) | ((_bfi) << 12) | ((_dec) << 11) | ((_im) << 10) | \ - ((_pst) << 9) | ((_sic) << 8) | ((_em) << 7) | (_enc)) - -#define VMMC_CMD_CODER_DATA2(_gain1, _gain2) (((_gain1) << 16) | (_gain2)) - -#define VMMC_CMD_CODER_DATA3(_de, _ee, _i2, _red, _i3, _plc, _i4, _i5) \ - (((_de) << 31) | ((_ee) << 30) | ((_i2) << 24) | ((_red) << 22) | \ - ((_i3) << 16) | ((_plc) << 15) | ((_i4) << 8) | (_i5)) - -#define VMMC_CMD_SERR_ACK(_chan) _VMMC_MSG(6, 7, 1) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(1) - -#define VMMC_CMD_SERR_ACK_DATA1(_foo) ((_foo) << 22) - -#define VMMC_CMD_CODER_DATA4(_tsf) ((_tsf) << 31) - -#define VMMC_EVENT_ID_MASK (_VMMC_MSG(0x1f, 0x7, 0x1f) | 0xff) - -#define VMMC_MSG_GET_CHAN(_msg) (((_msg) >> 16) & 0x1f) - -#define VMMC_EVENT_HOOK_STATE(_data) ((_data) & 1) - -#define VMMC_EVENT_HOOK_ID (_VMMC_MSG(9, 1, 1) | _VMMC_LENGTH(1)) -#define VMMC_EVENT_DTMF_ID (_VMMC_MSG(9, 2, 0) | _VMMC_LENGTH(1)) - -#define VMMC_VOICE_DATA(_type, _chan, _len) (((_type) << 24) | ((_chan) << 16) \ - | (_len)) - - -#define VMMC_CMD_ALI(_chan) (_VMMC_MSG(6, 1, 1) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(3)) - -#define VMMC_CMD_ALI_DATA1(_enable, _rate, _ud, _eh, _eo, _i1, _dg1) \ - (((_enable) << 31) | ((_rate) << 30) | ((_ud) << 29) | ((_eh) << 27) | \ - ((_eo) << 26) | ((_i1) << 16) | (_dg1)) - -#define VMMC_CMD_ALI_DATA2(_dg2, _i2, _i3) \ - (((_dg2) << 16) | ((_i2) << 8) | (_i3)) - -#define VMMC_CMD_ALI_DATA3(_i4, _i5) \ - (((_i4) << 24) | ((_i5) << 16)) - -#define VMMC_CMD_ALM_COEF(_chan, _offset, _len) \ - (_VMMC_MSG(2, 0, _offset) | _VMMC_CHAN(_chan) | (_len)) - -#define CMD_VOICEREC_STATUS_PACKET 0x0 -#define CMD_VOICEREC_DATA_PACKET 0x1 -#define CMD_RTP_VOICE_DATA_PACKET 0x4 -#define CMD_RTP_EVENT_PACKET 0x5 -#define CMD_ADDRESS_PACKET 0x8 -#define CMD_FAX_DATA_PACKET 0x10 -#define CMD_FAX_STATUS_PACKET 0x11 -#define CMD_P_PHONE_DATA_PACKET 0x12 -#define CMD_P_PHONE_STATUS_PACKET 0x13 - -#define VMMC_CMD_RTP_CFG_US(_chan) \ - (_VMMC_MSG(6, 3, 17) | _VMMC_CHAN(_chan) | (36)) -#define VMMC_CMD_RTP_CFG_DS(_chan) \ - (_VMMC_MSG(6, 3, 25) | _VMMC_CHAN(_chan) | (32)) - -#define VMMC_CMD_LEC(_chan) \ - (_VMMC_MSG(6, 2, 1) | _VMMC_CHAN(_chan) | _VMMC_LENGTH(1)) -// (_VMMC_MSG(CMD_EOP, ALI_LEC_ECMD, MOD_ALI) | _VMMC_CHAN(_chan) | (32)) - -#define VMMC_CMD_LEC_DATA() -#endif diff --git a/package/lqtapi/src/mps/vmmc-coder.c b/package/lqtapi/src/mps/vmmc-coder.c deleted file mode 100644 index 087a53bc7..000000000 --- a/package/lqtapi/src/mps/vmmc-coder.c +++ /dev/null @@ -1,221 +0,0 @@ -#include <linux/kernel.h> - -#include "vmmc.h" -#include "vmmc-cmds.h" -#include "vmmc-coder.h" -#include "vmmc-module.h" -#include "mps.h" - -enum vmmc_coder_encoding { - VMMC_CODER_ENCODING_ALAW = 2, - VMMC_CODER_ENCODING_MLAW = 3, - VMMC_CODER_ENCODING_G726_16 = 4, - VMMC_CODER_ENCODING_G726_24 = 5, - VMMC_CODER_ENCODING_G726_32 = 6, - VMMC_CODER_ENCODING_G726_40 = 7, - VMMC_CODER_ENCODING_AMR_4_75 = 8, - VMMC_CODER_ENCODING_AMR_5_15 = 9, - VMMC_CODER_ENCODING_AMR_5_9 = 10, - VMMC_CODER_ENCODING_AMR_6_7 = 11, - VMMC_CODER_ENCODING_AMR_7_4 = 12, - VMMC_CODER_ENCODING_AMR_7_95 = 13, - VMMC_CODER_ENCODING_AMR_10_2 = 14, - VMMC_CODER_ENCODING_AMR_12_2 = 15, - VMMC_CODER_ENCODING_G728_16 = 16, - VMMC_CODER_ENCODING_G729AB_8 = 18, - VMMC_CODER_ENCODING_G729E_11_8 = 19, - VMMC_CODER_ENCODING_G7221_24 = 20, - VMMC_CODER_ENCODING_G7221_32 = 21, - VMMC_CODER_ENCODING_G722_64 = 22, - VMMC_CODER_ENCODING_L16_8 = 24, - VMMC_CODER_ENCODING_L16_16 = 25, - VMMC_CODER_ENCODING_ILBC_15_2 = 26, - VMMC_CODER_ENCODING_ILBC_13_3 = 27, - VMMC_CODER_ENCODING_G7231_5_3 = 28, - VMMC_CODER_ENCODING_G7231_6_3 = 29, - VMMC_CODER_ENCODING_ALAW_VBD = 30, - VMMC_CODER_ENCODING_MLAW_VBD = 31, -}; - -static const uint8_t vmmc_coder_payload_mapping[] = { - [VMMC_CODER_ENCODING_ALAW] = 8, - [VMMC_CODER_ENCODING_MLAW] = 0, - [VMMC_CODER_ENCODING_G726_16] = 35, - [VMMC_CODER_ENCODING_G726_24] = 36, - [VMMC_CODER_ENCODING_G726_32] = 37, - [VMMC_CODER_ENCODING_G726_40] = 38, - [VMMC_CODER_ENCODING_AMR_4_75] = 39, - [VMMC_CODER_ENCODING_AMR_5_15] = 40, - [VMMC_CODER_ENCODING_AMR_5_9] = 41, - [VMMC_CODER_ENCODING_AMR_6_7] = 42, - [VMMC_CODER_ENCODING_AMR_7_4] = 43, - [VMMC_CODER_ENCODING_AMR_7_95] = 44, - [VMMC_CODER_ENCODING_AMR_10_2] = 45, - [VMMC_CODER_ENCODING_AMR_12_2] = 46, - [VMMC_CODER_ENCODING_G728_16] = 47, - [VMMC_CODER_ENCODING_G729AB_8] = 48, - [VMMC_CODER_ENCODING_G729E_11_8] = 49, - [VMMC_CODER_ENCODING_G7221_24] = 50, - [VMMC_CODER_ENCODING_G7221_32] = 51, - [VMMC_CODER_ENCODING_G722_64] = 52, - [VMMC_CODER_ENCODING_L16_8] = 11, - [VMMC_CODER_ENCODING_L16_16] = 10, - [VMMC_CODER_ENCODING_ILBC_15_2] = 53, - [VMMC_CODER_ENCODING_ILBC_13_3] = 54, - [VMMC_CODER_ENCODING_G7231_5_3] = 4, - [VMMC_CODER_ENCODING_G7231_6_3] = 4, - [VMMC_CODER_ENCODING_ALAW_VBD] = 55, - [VMMC_CODER_ENCODING_MLAW_VBD] = 56, -}; - -static uint32_t payload_enc[9]; -static uint32_t payload_dec[8]; - -static inline struct vmmc_coder *vmmc_module_to_coder(struct vmmc_module *module) -{ - return container_of(module, struct vmmc_coder, module); -} - -static int vmmc_coder_enable(struct vmmc_module *module, bool enable) -{ - struct vmmc_coder *coder = vmmc_module_to_coder(module); - - coder->enabled = enable; - -/* coder->cmd_cache[0] = VMMC_CMD_CODER_DATA1(coder->enabled, 0, 0, 0, coder->id, - module->pins[0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - return vmmc_command_write(coder->vmmc, VMMC_CMD_CODER(coder->id), - coder->cmd_cache);*/ - return 0; -} - -static int vmmc_coder_sync(struct vmmc_module *module) -{ - struct vmmc_coder *coder = vmmc_module_to_coder(module); - - coder->cmd_cache[0] = VMMC_CMD_CODER_DATA1(coder->enabled, 0, 1, 1, coder->id, - module->pins[0], 1, 1, 1, 1, 1, 1, 0, 0, 0, VMMC_CODER_ENCODING_MLAW); - coder->cmd_cache[1] = VMMC_CMD_CODER_DATA2(0x2000, 0x2000); - coder->cmd_cache[2] = VMMC_CMD_CODER_DATA3(0, 0, module->pins[1], 0, - module->pins[2], 0, module->pins[3], module->pins[4]); - - return vmmc_command_write(coder->vmmc, VMMC_CMD_CODER(coder->id), coder->cmd_cache); -} - -static const struct vmmc_module_ops vmmc_coder_module_ops = { - .sync = vmmc_coder_sync, - .enable = vmmc_coder_enable, -}; - -#define VMMC_CMD_CODER_JB(_chan) (_VMMC_MSG(6, 3, 18) | _VMMC_CHAN(_chan) | 8) -#define VMMC_CMD_CODER_JB_DATA1(_sf, _prp, _pje, _dvf, _nam, _rad, _adap, _init_pod) \ - (((_sf) << 31) | ((_prp) << 23) | ((_pje) << 22) | ((_dvf) << 21) | \ - ((_nam) << 20) | ((_rad) << 17) | ((_adap) << 16) | (_init_pod)) -#define VMMC_CMD_CODER_JB_DATA2(_min_pod, _max_pod) \ - (((_min_pod) << 16) | (_max_pod)) -#define VMMC_CMD_CODER_JB_DATA3(_adap_factor, _min_margin, _mode) \ - (((_adap_factor) << 24) | ((_min_margin) << 16) | (_mode)) - -int vmmc_coder_init(struct vmmc_coder *coder, struct vmmc *vmmc, unsigned int id) -{ - int ret; - - ret = vmmc_module_init(&coder->module, 5, &vmmc_coder_module_ops); - if (ret) - return ret; - - coder->id = id; - coder->module.id = id + 0x18; - coder->vmmc = vmmc; - coder->enabled = 0; - - coder->cmd_cache[0] = VMMC_CMD_CODER_DATA1(0, 0, 0, 0, id, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - coder->cmd_cache[1] = VMMC_CMD_CODER_DATA2(0, 0); - coder->cmd_cache[2] = VMMC_CMD_CODER_DATA3(0, 0, 0, 0, 0, 0, 0, 0); - coder->cmd_cache[3] = VMMC_CMD_CODER_DATA4(0); - - coder->jitter_buffer_cache[0] = VMMC_CMD_CODER_JB_DATA1(0x16, 1, 0, 0, 1, 1, - 1, 0x50); - coder->jitter_buffer_cache[1] = VMMC_CMD_CODER_JB_DATA2(0x50, 0x05a0); - coder->jitter_buffer_cache[2] = VMMC_CMD_CODER_JB_DATA3(0x0d, 0x28, 1); - - vmmc_command_write(coder->vmmc, VMMC_CMD_RTP_CFG_US(coder->id), payload_enc); - vmmc_command_write(coder->vmmc, VMMC_CMD_RTP_CFG_DS(coder->id), payload_dec); - vmmc_command_write(coder->vmmc, VMMC_CMD_CODER_JB(coder->id), - coder->jitter_buffer_cache); - vmmc_command_write(coder->vmmc, VMMC_CMD_CODER(coder->id), coder->cmd_cache); - - vmmc_register_module(vmmc, &coder->module); - - return ret; -} - -void vmmc_coder_event(struct vmmc *vmmc, unsigned int chan, unsigned int type) -{ -} - -/* -void vmmc_coder_event(struct vmmc_coder *coder, unsigned int len) -{ - struct sk_buff *skb; - provide_mem_region(coder->vmmc, vmmc_coder_alloc_paket(coder)->head, 512); - - skb = skb_dequeue(&coder->paket_queue); - skb_put(skb, len); - - tapi_stream_recv(&coder->vmmc->tdev, skb); -} -*/ -/* -int vmmc_coder_set_codec(struct vmmc_coder *coder, enum vmmc_codec codec) -{ -}*/ - -void vmmc_init_coders(struct vmmc *vmmc) -{ - unsigned int i; - - payload_enc[0] = 0; - payload_enc[1] = 0x0; - payload_enc[1] |= vmmc_coder_payload_mapping[2] << 8; - payload_enc[1] |= vmmc_coder_payload_mapping[3] << 8; - for (i = 2; i < 9; ++i) { - payload_enc[i] = vmmc_coder_payload_mapping[i*4 - 4] << 24; - payload_enc[i] |= vmmc_coder_payload_mapping[i*4 - 3] << 16; - payload_enc[i] |= vmmc_coder_payload_mapping[i*4 - 2] << 8; - payload_enc[i] |= vmmc_coder_payload_mapping[i*4 - 1]; - payload_enc[i] |= 0x80808080; - } - for (i = 0; i < 7; ++i) { - payload_dec[i] = vmmc_coder_payload_mapping[i*4 + 2] << 24; - payload_dec[i] |= vmmc_coder_payload_mapping[i*4 + 3] << 16; - payload_dec[i] |= vmmc_coder_payload_mapping[i*4 + 4] << 8; - payload_dec[i] |= vmmc_coder_payload_mapping[i*4 + 5]; - } - payload_dec[i] = vmmc_coder_payload_mapping[i*4 + 2] << 24; - payload_dec[i] |= vmmc_coder_payload_mapping[i*4 + 3] << 16; - - - vmmc->num_coders = 5; - vmmc->coder = kcalloc(sizeof(*vmmc->coder), vmmc->num_coders, GFP_KERNEL); - - for (i = 0; i < vmmc->num_coders; ++i) - vmmc_coder_init(&vmmc->coder[i], vmmc, i); -} - -struct vmmc_coder *vmmc_coder_get(struct vmmc *vmmc) -{ - unsigned int i; - for (i = 0; i < vmmc->num_coders; ++i) { - if (!test_and_set_bit(i, &vmmc->coder_used)) - return &vmmc->coder[i]; - } - - return NULL; -} - -void vmmc_coder_put(struct vmmc *vmmc, struct vmmc_coder *coder) -{ - clear_bit(coder->id, &vmmc->coder_used); -} diff --git a/package/lqtapi/src/mps/vmmc-coder.h b/package/lqtapi/src/mps/vmmc-coder.h deleted file mode 100644 index f5a87dcef..000000000 --- a/package/lqtapi/src/mps/vmmc-coder.h +++ /dev/null @@ -1,14 +0,0 @@ - -struct vmmc_coder { - struct vmmc *vmmc; - unsigned int id; - - struct vmmc_module module; - - unsigned int enabled; - - uint32_t cmd_cache[4]; - uint32_t jitter_buffer_cache[3]; - - struct tapi_stream *stream; -}; diff --git a/package/lqtapi/src/mps/vmmc-core.c b/package/lqtapi/src/mps/vmmc-core.c deleted file mode 100644 index 99b0d1d3d..000000000 --- a/package/lqtapi/src/mps/vmmc-core.c +++ /dev/null @@ -1,646 +0,0 @@ -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/platform_device.h> -#include <linux/slab.h> -#include <linux/interrupt.h> - -#include <linux/firmware.h> - -#include <linux/delay.h> - -#include <ifxmips_gptu.h> - -#include <linux/tapi/tapi.h> - -#include "vmmc.h" -#include "mps.h" -#include "mps-msg.h" -#include "mps-irq.h" -#include "vmmc-cmds.h" - -#include "vmmc-port.h" -#include "vmmc-stream.h" -#include "vmmc-link.h" -#include "vmmc-coder.h" - -struct vmmc_capabilities { - uint8_t num_alm; - uint8_t num_pcm; - uint8_t num_signal; - uint8_t num_coder; - uint8_t num_agc; - uint8_t num_eq; - uint8_t num_nlec; - uint8_t num_wlec; - uint8_t num_nwlec; - uint8_t num_wwlec; - uint8_t num_tone_generators; - uint8_t num_dtmf_generators; - uint8_t num_caller_id_senders; - uint8_t num_caller_id_recivers; -}; - -#define MPS_FIRMWARE_MAGIC 0xcc123456 - -struct vmmc_firmware_head { - uint32_t crc; - uint32_t crc_start_addr; - uint32_t crc_end_addr; - uint32_t version; - uint32_t encrypted; - uint32_t magic; - uint32_t mem; -} __packed; - -#define VMMC_FIFO_UPSTREAM_CMD_BASE_ADDR 0x00 -#define VMMC_FIFO_UPSTREAM_CMD_SIZE_ADDR 0x04 -#define VMMC_FIFO_DOWNSTREAM_CMD_BASE_ADDR 0x08 -#define VMMC_FIFO_DOWNSTREAM_CMD_SIZE_ADDR 0x0c -#define VMMC_FIFO_UPSTREAM_DATA_BASE_ADDR 0x10 -#define VMMC_FIFO_UPSTREAM_DATA_SIZE_ADDR 0x14 -#define VMMC_FIFO_DOWNSTREAM_DATA_BASE_ADDR 0x18 -#define VMMC_FIFO_DOWNSTREAM_DATA_SIZE_ADDR 0x1c -#define VMMC_FIFO_UPSTREAM_CMD_TAIL_ADDR 0x20 -#define VMMC_FIFO_UPSTREAM_CMD_HEAD_ADDR 0x24 -#define VMMC_FIFO_DOWNSTREAM_CMD_TAIL_ADDR 0x28 -#define VMMC_FIFO_DOWNSTREAM_CMD_HEAD_ADDR 0x2c -#define VMMC_FIFO_UPSTREAM_DATA_TAIL_ADDR 0x30 -#define VMMC_FIFO_UPSTREAM_DATA_HEAD_ADDR 0x34 -#define VMMC_FIFO_DOWNSTREAM_DATA_TAIL_ADDR 0x38 -#define VMMC_FIFO_DOWNSTREAM_DATA_HEAD_ADDR 0x3c - -#define VMMC_FIFO_EVENT_BASE_ADDR 0x180 -#define VMMC_FIFO_EVENT_SIZE_ADDR 0x184 -#define VMMC_FIFO_EVENT_TAIL_ADDR 0x188 -#define VMMC_FIFO_EVENT_HEAD_ADDR 0x18c - - -/* Calculates the base of the fifo behind the given fifo */ -#define VMMC_NEXT_FIFO_BASE0(_fifo) \ - (VMMC_FIFO_ ## _fifo ## _BASE + VMMC_FIFO_ ## _fifo ## _SIZE) -#define VMMC_NEXT_FIFO_BASE1(_fifo) \ - (VMMC_FIFO_ ## _fifo ## _BASE + VMMC_FIFO_ ## _fifo ## _SIZE) -#define VMMC_NEXT_FIFO_BASE2(_fifo) \ - (VMMC_FIFO_ ## _fifo ## _BASE + VMMC_FIFO_ ## _fifo ## _SIZE) - -/* Fifo sizes */ -#define VMMC_FIFO_UPSTREAM_CMD_SIZE 64 -#define VMMC_FIFO_DOWNSTREAM_CMD_SIZE 64 -#define VMMC_FIFO_UPSTREAM_DATA_SIZE 64 -#define VMMC_FIFO_DOWNSTREAM_DATA_SIZE 128 -#define VMMC_FIFO_EVENT_SIZE 64 - -/* Fifo addresses */ -#define VMMC_FIFO_UPSTREAM_CMD_BASE 0x40 -#define VMMC_FIFO_DOWNSTREAM_CMD_BASE VMMC_NEXT_FIFO_BASE0(UPSTREAM_CMD) -#define VMMC_FIFO_UPSTREAM_DATA_BASE VMMC_NEXT_FIFO_BASE1(DOWNSTREAM_CMD) -#define VMMC_FIFO_DOWNSTREAM_DATA_BASE VMMC_NEXT_FIFO_BASE2(UPSTREAM_DATA) -#define VMMC_FIFO_EVENT_BASE 0x190 - -#define VMMC_DECLARE_FIFO_CONFIG(_name, _fifo) \ -static const struct mps_fifo_config _name = { \ - .tail_addr = VMMC_FIFO_ ## _fifo ## _TAIL_ADDR, \ - .head_addr = VMMC_FIFO_ ## _fifo ## _HEAD_ADDR, \ - .base_addr = VMMC_FIFO_ ## _fifo ## _BASE_ADDR, \ - .size_addr = VMMC_FIFO_ ## _fifo ## _SIZE_ADDR, \ - .base = VMMC_FIFO_ ## _fifo ## _BASE, \ - .size = VMMC_FIFO_ ## _fifo ## _SIZE, \ -} - -VMMC_DECLARE_FIFO_CONFIG(vmmc_fifo_config_upstream_cmd, UPSTREAM_CMD); -VMMC_DECLARE_FIFO_CONFIG(vmmc_fifo_config_downstream_cmd, DOWNSTREAM_CMD); -VMMC_DECLARE_FIFO_CONFIG(vmmc_fifo_config_upstream_data, UPSTREAM_DATA); -VMMC_DECLARE_FIFO_CONFIG(vmmc_fifo_config_downstream_data, DOWNSTREAM_DATA); -VMMC_DECLARE_FIFO_CONFIG(vmmc_fifo_config_event, EVENT); - -static void vmmc_setup_fifos(struct vmmc *vmmc) -{ - mps_configure_mailbox(vmmc->mps, &vmmc->mbox_cmd, - &vmmc_fifo_config_upstream_cmd, &vmmc_fifo_config_downstream_cmd); - mps_configure_mailbox(vmmc->mps, &vmmc->mbox_data, - &vmmc_fifo_config_upstream_data, &vmmc_fifo_config_downstream_data); - - mps_configure_fifo(vmmc->mps, &vmmc->fifo_event, &vmmc_fifo_config_event); -} - -static uint32_t cram_data[] = { -0x00200000, 0x00008e59, 0x165235cd, 0x17e2f141, 0xe3eef301, 0x0a431281, -0x04fdf20d, 0x7fe363d5, 0xfd4b7333, 0x7ffffd44, 0xfcf80298, 0xfecd00c9, -0xff900042, 0xfff70003, 0x000923b7, 0xe92a354d, 0xc8981f44, 0x9c0f1257, -0x26aacf33, 0x27db9836, 0x10586f5b, 0x9c167d2d, 0x94b679a7, 0x8c227660, -0x83fa7491, 0x7ce0826a, 0x7ff87ff4, 0x296b4e22, 0x76e67fff, 0x008ffc04, -0x02cbfb36, 0x026afeba, 0x009effc3, 0x0013fffd, 0x23b7e92a, 0x354dc898, -0x1f449c0f, 0x125726aa, 0xcf3327db, 0x98361058, 0x74bc93d6, 0x7ebc8f61, -0x7d068986, 0x7b46833b, 0x7a3b7f00, 0x287a47b1, 0x05800367, 0x20ae2715, -0x0fb5da12, 0x1935f53b, 0x01230240, 0xfc717f00, 0x2000d346, -}; - -static void vmmc_push_data_paket(struct vmmc *vmmc, int type, unsigned int chan, - void __iomem *addr, size_t len) -{ - uint32_t data[3]; - - data[0] = VMMC_VOICE_DATA(type, chan, 8); - data[1] = CPHYSADDR(addr); - data[2] = len; - - mps_fifo_in(&vmmc->mbox_data.downstream, data, 3); -} - -static struct sk_buff *vmmc_alloc_data_paket(struct vmmc *vmmc) -{ - struct sk_buff *skb; - - skb = alloc_skb(512, GFP_KERNEL); - - skb_queue_tail(&vmmc->recv_queue, skb); - - return skb; -} - -static void vmmc_provide_paket(struct vmmc *vmmc) -{ - struct sk_buff *skb = vmmc_alloc_data_paket(vmmc); - vmmc_push_data_paket(vmmc, CMD_ADDRESS_PACKET, 0, skb->data, skb->len); -} - -static void vmmc_recv_paket(struct vmmc *vmmc, unsigned int chan, void __iomem *addr, size_t len) -{ - struct sk_buff *skb; - struct sk_buff *tmp; - - skb_queue_walk_safe(&vmmc->recv_queue, skb, tmp) { - if (skb->data == addr) - break; - } - - if (skb == (struct sk_buff *)(&vmmc->recv_queue)) { - printk("AHHHH\n"); - return; - } - - dma_cache_inv((u32)addr, len); - skb_unlink(skb, &vmmc->recv_queue); - - if (!vmmc->coder[chan].stream) { - kfree_skb(skb); - return; - } - - skb_put(skb, len); - tapi_stream_recv(&vmmc->tdev, vmmc->coder[chan].stream, skb); -} - -void vmmc_send_paket(struct vmmc *vmmc, unsigned int chan, struct sk_buff *skb) -{ - skb_queue_tail(&vmmc->send_queue, skb); - - dma_cache_wback((u32)skb->data, skb->len); - vmmc_push_data_paket(vmmc, CMD_RTP_VOICE_DATA_PACKET, chan, skb->data, - skb->len); -} - -static void vmmc_free_paket(struct vmmc *vmmc, void __iomem *addr, size_t len) -{ - struct sk_buff *skb; - struct sk_buff *tmp; - - skb_queue_walk_safe(&vmmc->send_queue, skb, tmp) { - if (skb->data == addr) - break; - } - - if (skb == (struct sk_buff *)(&vmmc->send_queue)) { - printk("AHHHH\n"); - } else { - skb_unlink(skb, &vmmc->send_queue); - kfree_skb(skb); - } -} - - -static void vmmc_write_cram_data(struct vmmc *vmmc, unsigned int id, - uint32_t *data, size_t length) -{ - size_t transfer_length; - size_t offset = 0; - uint32_t cmd; - - length *= 4; - offset = 0x5; - - while (length) { - transfer_length = length > 56 ? 56 : length; - cmd = VMMC_CMD_ALM_COEF(id, offset, transfer_length); - vmmc_command_write(vmmc, cmd, data); - - data += transfer_length >> 2; - offset += transfer_length >> 1; - length -= transfer_length; - } -} - -int vmmc_command_read(struct vmmc *vmmc, uint32_t cmd, uint32_t *result) -{ - struct mps_mailbox *mbox = &vmmc->mbox_cmd; - - INIT_COMPLETION(vmmc->cmd_completion); - - mps_fifo_in(&mbox->downstream, &cmd, 1); - - wait_for_completion(&vmmc->cmd_completion); - - mps_fifo_out(&mbox->upstream, result, 1); - mps_fifo_out(&mbox->upstream, result, (*result & 0xff) / 4); - - return 0; -} - -int vmmc_command_write(struct vmmc *vmmc, uint32_t cmd, - const uint32_t *data) -{ - struct mps_mailbox *mbox = &vmmc->mbox_cmd; -/* int i; - - printk("cmd: %x\n", cmd); - for (i = 0; i < DIV_ROUND_UP((cmd & 0xff), 4); ++i) { - printk("data[%d] = %x\n", i, data[i]); - } -*/ - while (mps_fifo_len(&mbox->downstream) < (cmd & 0xff) + 4) - mdelay(100); - - mps_fifo_in(&mbox->downstream, &cmd, 1); - mps_fifo_in(&mbox->downstream, data, DIV_ROUND_UP((cmd & 0xff), 4)); - - mdelay(100); - - return 0; -} - -static int vmmc_modules_sync(struct tapi_device *tapi) -{ - struct vmmc *vmmc = tdev_to_vmmc(tapi); - struct vmmc_module *module; - - list_for_each_entry(module, &vmmc->modules, head) - vmmc_module_sync(module); - - return 0; -} - -static const struct tapi_ops vmmc_tapi_ops = { - .send_dtmf_event = vmmc_port_send_dtmf_event, - .ring = vmmc_port_ring, - - .sync = vmmc_modules_sync, - - .stream_alloc = vmmc_stream_alloc, - .stream_free = vmmc_stream_free, - .stream_send = vmmc_stream_send, - - .link_alloc = vmmc_tapi_link_alloc, - .link_free = vmmc_tapi_link_free, - .link_enable = vmmc_tapi_link_enable, - .link_disable = vmmc_tapi_link_disable, -}; - -static void setup_alm(struct vmmc *vmmc) -{ - int i; - - vmmc->tdev.ports = kcalloc(2, sizeof(*vmmc->tdev.ports), GFP_KERNEL); - vmmc->ports = kcalloc(2, sizeof(*vmmc->ports), GFP_KERNEL); - - for (i = 0; i < 2; ++i) - vmmc_port_init(vmmc, &vmmc->ports[i], &vmmc->tdev.ports[i], i); - - skb_queue_head_init(&vmmc->send_queue); - skb_queue_head_init(&vmmc->recv_queue); - - for (i = 0; i < 10; ++i) - vmmc_provide_paket(vmmc); - - vmmc->tdev.num_ports = 2; - vmmc->tdev.ops = &vmmc_tapi_ops; - tapi_device_register(&vmmc->tdev, "vmmc", vmmc->dev); -} - -static void vmmc_init_timer(struct vmmc *vmmc) -{ - unsigned int timer; - unsigned int timer_flags; - int ret; - unsigned long loops, count; - - timer = TIMER1B; - - timer_flags = - TIMER_FLAG_16BIT | TIMER_FLAG_COUNTER | TIMER_FLAG_CYCLIC | - TIMER_FLAG_DOWN | TIMER_FLAG_FALL_EDGE | TIMER_FLAG_SYNC | - TIMER_FLAG_CALLBACK_IN_IRQ; - ret = ifxmips_request_timer (timer, timer_flags, 1, 0, 0); - if (ret < 0) { - printk("FAILED TO INIT TIMER\n"); - return; - } - ret = ifxmips_start_timer (timer, 0); - if (ret < 0) { - printk("FAILED TO START TIMER\n"); - return; - } - do - { - loops++; - ifxmips_get_count_value(timer, &count); - } while (count); - - *((volatile uint32_t *) (KSEG1 + 0x1e100a00 + 0x0014)) = 0x000005c5; -} - -static void vmmc_free_timer(struct vmmc *vmmc) -{ - ifxmips_free_timer(TIMER1B); -} - -static void vmmc_get_capabilities(struct vmmc *vmmc) -{ - uint32_t data[10]; - uint8_t len; - - vmmc_command_read(vmmc, - MPS_MSG_CMD_EOP_SYSTEM(SYS_CAP_ECMD, sizeof(uint32_t)), data); - - len = ((data[0] >> 16) & 0xff) - sizeof(uint32_t); - - if (len > sizeof(data)) - len = sizeof(data); - - vmmc_command_read(vmmc, - MPS_MSG_CMD_EOP_SYSTEM(SYS_CAP_ECMD, len), data); - - len /= 4; - -/* for (;len > 0; --len) { - printk("fw cap(%d): %.2x\n", 10-len, data[10-len]); - } -*/ - setup_alm(vmmc); -} - -static void vmmc_get_firmware_version(struct vmmc *vmmc) -{ - uint32_t data[1]; - - vmmc_command_read(vmmc, MPS_CMD_GET_VERSION, data); - - printk("firmware version: %x\n", *data); - - vmmc_get_capabilities(vmmc); -} - -static irqreturn_t vmmc_firmware_loaded_irq(int irq, void *devid) -{ - struct vmmc *vmmc = devid; - complete(&vmmc->firmware_loaded_completion); - printk("Firmware loaded irq\n"); - - return IRQ_HANDLED; -} - -static irqreturn_t vmmc_cmd_error_irq(int irq, void *devid) -{ -/* struct vmmc *vmmc = devid;*/ - - printk("cmd error!!!!\n"); - - return IRQ_HANDLED; -} - -static irqreturn_t vmmc_recv_ov_irq(int irq, void *devid) -{ - struct vmmc *vmmc = devid; - uint32_t data[2] = { - VMMC_CMD_SERR_ACK(0), - VMMC_CMD_SERR_ACK_DATA1(1) - }; - uint32_t voice_data[64]; - - return IRQ_HANDLED; - - mps_fifo_in(&vmmc->mbox_cmd.downstream, data, 2); - mps_fifo_out(&vmmc->mbox_data.upstream, voice_data, 15); - - printk("recv overflow: %x\n", voice_data[0]); - - return IRQ_HANDLED; -} - -static irqreturn_t vmmc_event_fifo_irq(int irq, void *devid) -{ - struct vmmc *vmmc = devid; - uint32_t event, event_id; - uint32_t data = 0; - unsigned int chan; - - mps_fifo_out(&vmmc->fifo_event, &event, 1); - - event_id = event & VMMC_EVENT_ID_MASK; - chan = VMMC_MSG_GET_CHAN(event); - - if (event & 0xff) - mps_fifo_out(&vmmc->fifo_event, &data, 1); - - switch (event_id) { - case VMMC_EVENT_HOOK_ID: - vmmc_alm_hook_event_handler(vmmc, chan, data); - break; - case VMMC_EVENT_DTMF_ID: - vmmc_sig_dtmf_event_handler(vmmc, chan, data); - break; - default: - printk("Ein unbekanntes Event: %x %x\n", event, data); - break; - } - - return IRQ_HANDLED; -} - -static irqreturn_t vmmc_mbox_data_irq_handler(int irq, void *devid) -{ - struct vmmc *vmmc = devid; - struct mps_mailbox *mbox = &vmmc->mbox_data; - unsigned int count, type, chan; - uint32_t data[2]; - void __iomem *addr; - size_t len; - - mps_fifo_out(&mbox->upstream, data, 1); - - count = (data[0] & 0xff) / 8; - type = (data[0] >> 24) & 0xff; - chan = (data[0] >> 16) & 0xff; - - while (count) { - mps_fifo_out(&mbox->upstream, data, 2); - - addr = (void __iomem *)CKSEG0ADDR(data[0]); - len = data[1]; - - switch (type) { - case CMD_ADDRESS_PACKET: - vmmc_free_paket(vmmc, addr, len); - break; - case CMD_RTP_VOICE_DATA_PACKET: - vmmc_provide_paket(vmmc); - vmmc_recv_paket(vmmc, chan, addr, len); - break; - } - --count; - } - - return IRQ_HANDLED; -} - -static irqreturn_t vmmc_mbox_cmd_irq_handler(int irq, void *devid) -{ - struct vmmc *vmmc = devid; - - complete(&vmmc->cmd_completion); - - return IRQ_HANDLED; -} - -static void vmmc_load_firmware(const struct firmware *fw, void *context) -{ - struct vmmc *vmmc = context; - struct vmmc_firmware_head *fw_head; - size_t tail_size; - enum mps_boot_config config; - - if (!fw) { - printk("failed to load tapi firmware\n"); -// request_firmware_nowait(THIS_MODULE, 1, "danube_firmware.bin", vmmc->dev, -// GFP_KERNEL, vmmc, vmmc_load_firmware); - return; - } - - if (fw->size < sizeof(*fw_head)) - return; - - fw_head = (struct vmmc_firmware_head *)((uint8_t *)fw->data + fw->size - sizeof(*fw_head)); - - if (fw_head->magic != MPS_FIRMWARE_MAGIC) { - config = MPS_BOOT_LEGACY; - tail_size = sizeof(uint32_t); - } else { - config = MPS_BOOT_ENCRYPTED; - tail_size = sizeof(*fw_head) - sizeof(uint32_t); - } - - vmmc_setup_fifos(vmmc); - init_completion(&vmmc->firmware_loaded_completion); - mps_load_firmware(vmmc->mps, fw->data, fw->size - tail_size, config); - wait_for_completion_timeout(&vmmc->firmware_loaded_completion, 5*HZ); - vmmc_init_timer(vmmc); - vmmc_write_cram_data(vmmc, 0, cram_data, ARRAY_SIZE(cram_data)); - vmmc_write_cram_data(vmmc, 1, cram_data, ARRAY_SIZE(cram_data)); - vmmc_get_firmware_version(vmmc); - vmmc_init_coders(vmmc); -} - -static int vmmc_request_irqs(struct vmmc *vmmc) -{ - int ret; - - ret = request_irq(vmmc->irq_fw_loaded, vmmc_firmware_loaded_irq, 0, "vmmc fw loaded", vmmc); - ret = request_irq(vmmc->irq_event_fifo, vmmc_event_fifo_irq, 0, "vmmc event fifo", vmmc); - ret = request_irq(vmmc->irq_cmd_error, vmmc_cmd_error_irq, 0, - "cmd error irq", vmmc); - ret = request_irq(MPS_IRQ_RCV_OVERFLOW, vmmc_recv_ov_irq, 0, - "recv_ov irq", vmmc); - - ret = request_irq(vmmc->irq_mbox_cmd, vmmc_mbox_cmd_irq_handler, 0, - "vmmc cmd mailbox irq", vmmc); - - ret = request_irq(vmmc->irq_mbox_data, vmmc_mbox_data_irq_handler, 0, - "vmmc data mailbox irq", vmmc); - - return ret; -} - -static int __devinit vmmc_probe(struct platform_device *pdev) -{ - struct vmmc *vmmc; - int ret = 0; - - vmmc = kzalloc(sizeof(*vmmc), GFP_KERNEL); - - if (!vmmc) - return -ENOMEM; - - vmmc->dev = &pdev->dev; - vmmc->mps = device_to_mps(pdev->dev.parent); - - if (!vmmc->mps) { - goto err_free; - ret = -EBUSY; - } - - INIT_LIST_HEAD(&vmmc->modules); - init_completion(&vmmc->cmd_completion); - - vmmc->irq_fw_loaded = MPS_IRQ_DOWNLOAD_DONE; - vmmc->irq_mbox_cmd = MPS_IRQ_CMD_UPSTREAM; - vmmc->irq_mbox_data = MPS_IRQ_DATA_UPSTREAM; - vmmc->irq_event_fifo = MPS_IRQ_EVENT; - vmmc->irq_cmd_error = MPS_IRQ_CMD_ERROR; - - platform_set_drvdata(pdev, vmmc); - - vmmc_request_irqs(vmmc); - - request_firmware_nowait(THIS_MODULE, 1, "danube_firmware.bin", &pdev->dev, - GFP_KERNEL, vmmc, vmmc_load_firmware); - - return 0; - -err_free: - kfree(vmmc); - - return ret; -} - -static int __devexit vmmc_remove(struct platform_device *pdev) -{ - struct vmmc *vmmc = platform_get_drvdata(pdev); - vmmc_free_timer(vmmc); - - tapi_device_unregister(&vmmc->tdev); - - return 0; -} - -static struct platform_driver vmmc_driver = { - .probe = vmmc_probe, - .remove = __devexit_p(vmmc_remove), - .driver = { - .name = "vmmc", - .owner = THIS_MODULE - }, -}; - -static int __init vmmc_init(void) -{ - return platform_driver_register(&vmmc_driver); -} -module_init(vmmc_init); - -static void __exit vmmc_exit(void) -{ - platform_driver_unregister(&vmmc_driver); -} -module_exit(vmmc_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); diff --git a/package/lqtapi/src/mps/vmmc-link.c b/package/lqtapi/src/mps/vmmc-link.c deleted file mode 100644 index 42d11dbb6..000000000 --- a/package/lqtapi/src/mps/vmmc-link.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/tapi/tapi.h> - -#include "vmmc-link.h" -#include "vmmc-module.h" - -struct vmmc_tapi_link { - struct tapi_link tapi_link; - struct vmmc_link vmmc_link; -}; - -struct tapi_link *vmmc_tapi_link_alloc(struct tapi_device *tdev, - struct tapi_endpoint *ep1, struct tapi_endpoint *ep2) -{ - struct vmmc_tapi_link *link = kzalloc(sizeof(*link), GFP_KERNEL); - struct vmmc_module *module1 = tapi_endpoint_to_vmmc_module(ep1); - struct vmmc_module *module2 = tapi_endpoint_to_vmmc_module(ep2); - - vmmc_link_init(&link->vmmc_link, module1, module2); - - return &link->tapi_link; -} - -void vmmc_tapi_link_free(struct tapi_device *tdev, struct tapi_link *tapi_link) -{ - struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link, - tapi_link); - - vmmc_link_put(&link->vmmc_link); - kfree(link); -} - -int vmmc_tapi_link_enable(struct tapi_device *tdev, - struct tapi_link *tapi_link) -{ - struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link, - tapi_link); - - vmmc_link_enable(&link->vmmc_link); - return 0; -} - -int vmmc_tapi_link_disable(struct tapi_device *tdev, - struct tapi_link *tapi_link) -{ - struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link, - tapi_link); - - vmmc_link_disable(&link->vmmc_link); - return 0; -} diff --git a/package/lqtapi/src/mps/vmmc-link.h b/package/lqtapi/src/mps/vmmc-link.h deleted file mode 100644 index 9f818bd83..000000000 --- a/package/lqtapi/src/mps/vmmc-link.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __VMMC_LINK_H__ -#define __VMMC_LINK_H__ - -struct tapi_link *vmmc_tapi_link_alloc(struct tapi_device *tdev, - struct tapi_endpoint *ep1, struct tapi_endpoint *ep2); -void vmmc_tapi_link_free(struct tapi_device *tdev, struct tapi_link *link); -int vmmc_tapi_link_enable(struct tapi_device *tdev, struct tapi_link *link); -int vmmc_tapi_link_disable(struct tapi_device *tdev, struct tapi_link *link); - -#endif diff --git a/package/lqtapi/src/mps/vmmc-module.c b/package/lqtapi/src/mps/vmmc-module.c deleted file mode 100644 index 181f0c6b7..000000000 --- a/package/lqtapi/src/mps/vmmc-module.c +++ /dev/null @@ -1,130 +0,0 @@ -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/mutex.h> - -#include <asm/bitops.h> - -#include "vmmc-module.h" - -int vmmc_module_init(struct vmmc_module *module, size_t num_pins, - const struct vmmc_module_ops *ops) -{ - module->pins = kcalloc(num_pins, sizeof(*module->pins), GFP_KERNEL); - - if (!module->pins) - return -ENOMEM; - - module->num_pins = num_pins; - module->ops = ops; - - mutex_init(&module->lock); - module->refcount = 0; - - return 0; -} - -int vmmc_module_sync(struct vmmc_module *module) -{ - if (!test_and_clear_bit(VMMC_MODULE_FLAG_MODIFIED, &module->flags)) - return 0; - - return module->ops->sync(module); -} - -int vmmc_module_get_pin(struct vmmc_module *module) -{ - size_t i = 0; - int ret = 0; - - for (i = 0; i < module->num_pins; ++i) { - if (!test_and_set_bit(VMMC_MODULE_FLAG_PIN_USED(i), &module->flags)) - break; - } - if (i == module->num_pins) - ret = -EBUSY; - else - ret = i; - - return ret; -} - -void vmmc_module_put_pin(struct vmmc_module *module, unsigned int pin) -{ - module->pins[pin] = 0; - clear_bit(VMMC_MODULE_FLAG_PIN_USED(pin), &module->flags); -} - -void vmmc_module_set_pin_input(struct vmmc_module *module, unsigned int pin, - struct vmmc_module *input) -{ - if (input) - module->pins[pin] = input->id; - else - module->pins[pin] = 0; - - set_bit(VMMC_MODULE_FLAG_MODIFIED, &module->flags); -} - -static void vmmc_module_enable(struct vmmc_module *module) -{ - mutex_lock(&module->lock); - - if (++module->refcount == 1) - module->ops->enable(module, true); - - mutex_unlock(&module->lock); -} - -static void vmmc_module_disable(struct vmmc_module *module) -{ - mutex_lock(&module->lock); - - if (module->refcount <= 0) - printk(KERN_ERR "vmmc module: unbalanced disable\n"); - else if (--module->refcount == 0) - module->ops->enable(module, false); - - mutex_unlock(&module->lock); -} - - -unsigned int vmmc_link_init(struct vmmc_link *link, - struct vmmc_module *a, struct vmmc_module *b) -{ - link->pins[0] = vmmc_module_get_pin(a); - link->pins[1] = vmmc_module_get_pin(b); - link->modules[0] = a; - link->modules[1] = b; - - return 0; -} - -void vmmc_link_put(struct vmmc_link *link) -{ - vmmc_link_disable(link); - vmmc_module_sync(link->modules[0]); - vmmc_module_sync(link->modules[1]); - vmmc_module_put_pin(link->modules[0], link->pins[0]); - vmmc_module_put_pin(link->modules[1], link->pins[1]); -} - -void vmmc_link_enable(struct vmmc_link *link) -{ - vmmc_module_set_pin_input(link->modules[0], link->pins[0], - link->modules[1]); - vmmc_module_set_pin_input(link->modules[1], link->pins[1], - link->modules[0]); - - vmmc_module_enable(link->modules[0]); - vmmc_module_enable(link->modules[1]); -} - -void vmmc_link_disable(struct vmmc_link *link) -{ - vmmc_module_set_pin_input(link->modules[0], link->pins[0], NULL); - vmmc_module_set_pin_input(link->modules[1], link->pins[1], NULL); - - vmmc_module_disable(link->modules[0]); - vmmc_module_disable(link->modules[1]); -} diff --git a/package/lqtapi/src/mps/vmmc-module.h b/package/lqtapi/src/mps/vmmc-module.h deleted file mode 100644 index b598d0dcd..000000000 --- a/package/lqtapi/src/mps/vmmc-module.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __VMMC_MODULE_H__ -#define __VMMC_MODULE_H__ - -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/tapi/tapi.h> - -struct vmmc_module; - -struct vmmc_module_ops { - int (*sync)(struct vmmc_module *); - int (*enable)(struct vmmc_module *, bool enable); -}; - -struct vmmc_module -{ - unsigned int id; - - size_t num_pins; - unsigned int *pins; - - const struct vmmc_module_ops *ops; - - unsigned long flags; -#define VMMC_MODULE_FLAG_PIN_USED(x) (x) -#define VMMC_MODULE_FLAG_MODIFIED 31 - struct mutex lock; - struct list_head head; - - unsigned int refcount; -}; - -int vmmc_module_init(struct vmmc_module *module, size_t num_pins, - const struct vmmc_module_ops *ops); -int vmmc_module_sync(struct vmmc_module *module); - -struct vmmc_link { - struct vmmc_module *modules[2]; - unsigned int pins[2]; -}; - -struct vmmc_endpoint { - struct tapi_endpoint ep; - struct vmmc_module *module; -}; - -void vmmc_link_enable(struct vmmc_link *link); -void vmmc_link_disable(struct vmmc_link *link); -unsigned int vmmc_link_init(struct vmmc_link *link, - struct vmmc_module *a, struct vmmc_module *b); -void vmmc_link_put(struct vmmc_link *link); - -int vmmc_module_get_pin(struct vmmc_module *module); -void vmmc_module_put_pin(struct vmmc_module *module, unsigned int pin); -void vmmc_module_set_pin_input(struct vmmc_module *module, unsigned int pin, - struct vmmc_module *input); - - -static inline struct vmmc_module *tapi_endpoint_to_vmmc_module(struct tapi_endpoint *ep) -{ - return tapi_endpoint_get_data(ep); -} - -#endif diff --git a/package/lqtapi/src/mps/vmmc-port.c b/package/lqtapi/src/mps/vmmc-port.c deleted file mode 100644 index aa620a1e0..000000000 --- a/package/lqtapi/src/mps/vmmc-port.c +++ /dev/null @@ -1,48 +0,0 @@ -#include <linux/kernel.h> -#include <linux/slab.h> - -#include <linux/tapi/tapi.h> - -#include "vmmc.h" -#include "vmmc-port.h" -#include "vmmc-alm.h" -#include "vmmc-sig.h" - -int vmmc_port_ring(struct tapi_device *tdev, struct tapi_port *port, bool ring) -{ - struct vmmc *vmmc = tdev_to_vmmc(tdev); - - return vmmc_alm_set_state(&vmmc->ports[port->id].alm, - ring ? VMMC_ALM_STATE_RING : VMMC_ALM_STATE_ONHOOK); -} - -int vmmc_port_send_dtmf_event(struct tapi_device *tdev, - struct tapi_port *port, struct tapi_dtmf_event *event) -{ - return 0; -} - -struct vmmc_port *vmmc_port_init(struct vmmc *vmmc, struct vmmc_port *port, - struct tapi_port *tport, unsigned int id) -{ - vmmc_alm_init(&port->alm, vmmc, id); - vmmc_sig_init(&port->sig, vmmc, id); - - port->sig_pin = vmmc_module_get_pin(&port->sig.module); - vmmc_module_set_pin_input(&port->sig.module, port->sig_pin, - &port->alm.module); - - vmmc_module_sync(&port->sig.module); - - vmmc_alm_set_state(&port->alm, VMMC_ALM_STATE_ONHOOK); - - tport->id = id; - tapi_endpoint_set_data(&tport->ep, &port->alm.module); - - return port; -} - -void vmmc_port_put(struct vmmc *vmmc, struct vmmc_port *port) -{ - vmmc_module_put_pin(&port->sig.module, port->sig_pin); -} diff --git a/package/lqtapi/src/mps/vmmc-port.h b/package/lqtapi/src/mps/vmmc-port.h deleted file mode 100644 index 1efceb0b2..000000000 --- a/package/lqtapi/src/mps/vmmc-port.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __VMMC_PORT_H__ -#define __VMMC_PORT_H__ - -#include "vmmc-alm.h" -#include "vmmc-sig.h" - -void vmmc_port_free(struct vmmc *vmmc, struct vmmc_port *port); - -int vmmc_port_ring(struct tapi_device *tdev, struct tapi_port *port, bool ring); -int vmmc_port_send_dtmf_event(struct tapi_device *tdev, - struct tapi_port *port, struct tapi_dtmf_event *event); -struct vmmc_port *vmmc_port_init(struct vmmc *vmmc, struct vmmc_port *port, -struct tapi_port *tport, unsigned int id); - -struct vmmc_port -{ - struct vmmc_alm alm; - struct vmmc_sig sig; - unsigned int sig_pin; -}; - -#endif diff --git a/package/lqtapi/src/mps/vmmc-sig.h b/package/lqtapi/src/mps/vmmc-sig.h deleted file mode 100644 index e8f047063..000000000 --- a/package/lqtapi/src/mps/vmmc-sig.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __VMMC_SIG_H__ -#define __VMMC_SIG_H__ - -#include "vmmc-module.h" - -struct vmmc_sig { - struct vmmc *vmmc; - unsigned int id; - struct vmmc_module module; - - uint32_t sig_cache; - uint32_t dtmfr_cache; -}; - -int vmmc_sig_init(struct vmmc_sig *sig, struct vmmc *vmmc, unsigned int id); - -void vmmc_sig_dtmf_event_handler(struct vmmc *vmmc, uint32_t event, uint32_t data); - -#endif diff --git a/package/lqtapi/src/mps/vmmc-signal.c b/package/lqtapi/src/mps/vmmc-signal.c deleted file mode 100644 index 83fea6083..000000000 --- a/package/lqtapi/src/mps/vmmc-signal.c +++ /dev/null @@ -1,69 +0,0 @@ -#include <linux/kernel.h> - -#include "vmmc.h" -#include "vmmc-sig.h" -#include "vmmc-cmds.h" - -static struct vmmc_sig *vmmc_module_to_sig(struct vmmc_module *module) -{ - return container_of(module, struct vmmc_sig, module); -} - -static int vmmc_sig_enable(struct vmmc_module *module, bool enabled) -{ - struct vmmc_sig *sig = vmmc_module_to_sig(module); - - return 0; - - sig->sig_cache = VMMC_CMD_SIG_SET_ENABLE(sig->sig_cache, enabled); - - return vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id), &sig->sig_cache); -} - -static int vmmc_sig_sync(struct vmmc_module *module) -{ - struct vmmc_sig *sig = vmmc_module_to_sig(module); - - sig->sig_cache = VMMC_CMD_SIG_SET_INPUTS(sig->sig_cache, - module->pins[0], module->pins[1]); - - vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id), - &sig->sig_cache); - - return vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id), - &sig->dtmfr_cache); -} - -static const struct vmmc_module_ops vmmc_sig_ops = { - .enable = vmmc_sig_enable, - .sync = vmmc_sig_sync, -}; - -int vmmc_sig_init(struct vmmc_sig *sig, struct vmmc *vmmc, unsigned int id) -{ - int ret; - - ret = vmmc_module_init(&sig->module, 2, &vmmc_sig_ops); - if (ret) - return ret; - - sig->id = id; - sig->module.id = id + 0x1e; - sig->vmmc = vmmc; - sig->sig_cache = VMMC_CMD_SIG_DATA(1, 1, 0, 0, 0, 0, 0); - sig->dtmfr_cache = VMMC_CMD_DTMFR_DATA(1, 1, id); - - vmmc_register_module(vmmc, &sig->module); - - vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id), - &sig->sig_cache); - vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id), - &sig->dtmfr_cache); - - return ret; -} - -void vmmc_sig_dtmf_event_handler(struct vmmc *vmmc, uint32_t id, uint32_t data) -{ - tapi_report_dtmf_event(&vmmc->tdev, &vmmc->tdev.ports[id], data & 0xf); -} diff --git a/package/lqtapi/src/mps/vmmc-stream.c b/package/lqtapi/src/mps/vmmc-stream.c deleted file mode 100644 index 36f5eef80..000000000 --- a/package/lqtapi/src/mps/vmmc-stream.c +++ /dev/null @@ -1,73 +0,0 @@ -#include <linux/kernel.h> -#include <linux/tapi/tapi.h> -#include <linux/skbuff.h> - -#include "vmmc.h" -#include "vmmc-coder.h" - -struct vmmc_tapi_stream { - struct vmmc_coder *coder; - struct tapi_stream stream; -}; - -struct vmmc_tapi_stream *tapi_to_vmmc_stream(struct tapi_stream * stream) -{ - return container_of(stream, struct vmmc_tapi_stream, stream); -} - -struct tapi_stream *vmmc_stream_alloc(struct tapi_device *tdev) -{ - struct vmmc *vmmc = tdev_to_vmmc(tdev); - struct vmmc_tapi_stream *stream; - struct vmmc_coder *coder; - - coder = vmmc_coder_get(vmmc); - if (!coder) - return ERR_PTR(-ENODEV); - - stream = kzalloc(sizeof(*stream), GFP_KERNEL); - if (!stream) - return ERR_PTR(-ENOMEM); - - stream->coder = coder; - coder->stream = &stream->stream; - tapi_endpoint_set_data(&stream->stream.ep, &coder->module); - - return &stream->stream; -} - -void vmmc_stream_free(struct tapi_device *tdev, struct tapi_stream *tstream) -{ - struct vmmc *vmmc = tdev_to_vmmc(tdev); - struct vmmc_tapi_stream *stream = tapi_to_vmmc_stream(tstream); - - stream->coder->stream = NULL; - - vmmc_coder_put(vmmc, stream->coder); - kfree(stream); -} - -int vmmc_stream_start(struct tapi_device *tdev, struct tapi_stream *stream) -{ - return 0; -} - -int vmmc_stream_stop(struct tapi_device *tdev, struct tapi_stream *stream) -{ - return 0; -} - -int vmmc_stream_send(struct tapi_device *tdev, struct tapi_stream *stream, - struct sk_buff *skb) -{ - struct vmmc *vmmc = tdev_to_vmmc(tdev); - struct vmmc_coder *coder = tapi_to_vmmc_stream(stream)->coder; - - vmmc_send_paket(vmmc, coder->id, skb); - return 0; -} -/* -int vmmc_stream_recv(struct vmmc_stream *stream) -{ - tapi_stream_recv(&stream->coder->vmmc->tdev stream->stream, skb); -}*/ diff --git a/package/lqtapi/src/mps/vmmc-stream.h b/package/lqtapi/src/mps/vmmc-stream.h deleted file mode 100644 index 7e029734f..000000000 --- a/package/lqtapi/src/mps/vmmc-stream.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __VMMC_STREAM_H__ -#define __VMMC_STREAM_H__ - -struct tapi_stream *vmmc_stream_alloc(struct tapi_device *tdev); -void vmmc_stream_free(struct tapi_device *tdev, struct tapi_stream *stream); -int vmmc_stream_start(struct tapi_device *tdev, struct tapi_stream *stream); -int vmmc_stream_send(struct tapi_device *tdev, struct tapi_stream *stream, - struct sk_buff *skb); - -#endif diff --git a/package/lqtapi/src/mps/vmmc.c b/package/lqtapi/src/mps/vmmc.c deleted file mode 100644 index ba7d435af..000000000 --- a/package/lqtapi/src/mps/vmmc.c +++ /dev/null @@ -1,90 +0,0 @@ -static uint32_t magic_init[] = { -/* ALI INIT */ -/*0x0601210c, 0x88002000, 0x20000000, 0x00000000, 0xffffffff,*/ -/* COD_CHAN_SPEECH_ECMD */ -/*0x06016110, 0x2462f700, 0x20002000, 0x00000000, 0x00000000, 0xffffffff,*/ -/* COD_DEC_STAT_ECMD */ -/*0x06017504, 0x00c00000, 0xffffffff,*/ -/* COD_JB_CONF_ECMD */ -/*0x06017208, 0x16410050, 0x005005a0, 0xffffffff,*/ -/* SIG_RTP_SUP */ -/*0x0601500c, 0x00000000, 0x00000060, 0x0712007f, 0xffffffff,*/ -/* SIG_CHAN */ -/*0x06014104, 0xc0190000, 0xffffffff,*/ -/* SIG_CIDS_CTRL_ECMD */ -/*0x06014204, 0x3811e000, 0xffffffff, */ -/* SIG_DTMFATG_DATA */ -/*0x06014b04, 0x00010000, 0xffffffff,*/ -/* SIG_DTMFATG_CTRL */ -/*0x06014304, 0x6a110000, 0xffffffff, -0x0601cc04, 0xe21c2000, 0xffffffff, -0x06014404, 0xb0110000, 0xffffffff, -0x06014a04, 0x04510000, 0xffffffff, -0x06014604, 0x04560000, 0xffffffff, -0x06014104, 0xc0190000, 0xffffffff,*/ -/* COD_CHAN_RTP_SUP_CFG_USD */ -/*0x06017124, 0x00000000, 0x00008880, 0xe3e4e5e6, 0x72727272, 0x72727272, -0x0f7f1261, 0x7374097f, 0xf1f06767, 0x04047675, 0xffffffff,*/ -/* COD_CHAN_RTP_SUP_CFG_DS */ -/* 0x06017920, 0x08006364, 0x65667272, 0x72727272, 0x72720f7f, 0x12617374, -0x097f7170, 0x67670404, 0x76750000, 0xffffffff, */ -/* OPMODE_CMD */ -0x01010004, 0x00010000, 0xffffffff, -0x01000004, 0x00030000, 0xffffffff, -/*0x01010004, 0x00010000, 0xffffffff,*/ -/* COD_CHAN_RTP_SUP_CFG_US */ -/* 0x06017124, 0x00000000, 0x00008880, 0xe3e4e5e6, 0x72727272, 0x72727272, -0x0f7f1261, 0x7374097f, 0xf1f06767, 0x04047675, 0xffffffff, */ -/* COD_CHAN_RTP_SUP_CFG_DS */ -/* 0x06017920, 0x08006364, 0x65667272, 0x72727272, 0x72720f7f, 0x12617374, -0x097f7170, 0x67670404, 0x76750000, 0xffffffff, */ -/* COD_JB_CONF */ -/* 0x06017208, 0x16410050, 0x005005a0, 0xffffffff, */ -/* COD_CHAN_RTP_SUP_CFG_US */ -/*0x06017108, 0x00000000, 0x00008880, 0xffffffff,*/ -/* COD_CHAN_RTP_TIMESTAMP */ -/*0x06017004, 0x00000000, 0xffffffff,*/ -/* SIG_RTP_SUP */ -/* 0x0601500c, 0x00000000, 0x00000062, 0x0712007f, 0xffffffff,*/ -/* SIG_DTMFR_CTRL */ -/*0x06014404, 0xb0010000, 0xffffffff,*/ -/* COD_CHAN_SPEECH */ -/* 0x06016110, 0x0462d600, 0x20002000, 0x00000000, 0x00000000, 0xffffffff, */ -/* ALI_CHAN */ -0x0601210c, 0x88232000, 0x20000000, 0x00000000, 0xffffffff, -/* SIG_CHAN */ -/*0x06014104, 0xc5190000, 0xffffffff,*/ -/* SIG_DTMFR_CTRL_ECMD */ -/*0x06014404, 0x30010000, 0xffffffff,*/ -/* SIG_CHAN_ECMD */ -/*0x06014104, 0x45190000, 0xffffffff,*/ -}; - -static void setup_alm(struct mps *mps, int chan) -{ - uint32_t *data = magic_init; - int size, i; - -/* data[0] = ALI_CHAN_DATA1(1, 0, 0, 1, 1, 0, 0); - data[1] = ALI_CHAN_DATA2(0, 0, 0); - data[2] = ALI_CHAN_DATA3(0, 0);*/ - - size = 1; - for (i = 1; i < ARRAY_SIZE(magic_init); ++i) { - if (magic_init[i] == 0xffffffff) { - - printk("cmd: %x\n", *data); - VMMC_FIFO_fifo_in(&mps->mbox_cmd.downstream, data, size); - size = 0; - data = &magic_init[i+1]; - mdelay(500); - } else { - size += 1; - } - } - - -/* VMMC_FIFO_mailbox_command_write(&mps->mbox_cmd, MPS_CMD_ALI(chan), data);*/ -} - - diff --git a/package/lqtapi/src/mps/vmmc.h b/package/lqtapi/src/mps/vmmc.h deleted file mode 100644 index f442a9ab4..000000000 --- a/package/lqtapi/src/mps/vmmc.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __VMMC_H__ - -#include <linux/list.h> -#include <linux/tapi/tapi.h> - -#include "mps.h" -#include "vmmc-module.h" - -struct vmmc -{ - struct mps *mps; - struct device *dev; - - struct vmmc_port *ports; - - struct completion firmware_loaded_completion; - struct completion cmd_completion; - - struct mps_mailbox mbox_cmd; - struct mps_mailbox mbox_data; - struct mps_fifo fifo_event; - - int irq_fw_loaded; - int irq_mbox_cmd; - int irq_mbox_data; - int irq_event_fifo; - int irq_cmd_error; - - unsigned int num_coders; - struct vmmc_coder *coder; - unsigned long coder_used; - - struct list_head modules; - - struct tapi_device tdev; - - struct sk_buff_head recv_queue; - struct sk_buff_head send_queue; -}; - -static inline struct vmmc *tdev_to_vmmc(struct tapi_device *tdev) -{ - return container_of(tdev, struct vmmc, tdev); -} - -static inline void vmmc_register_module(struct vmmc *vmmc, - struct vmmc_module *module) -{ - list_add_tail(&module->head, &vmmc->modules); -} - -static inline void vmmc_unregister_module(struct vmmc *vmmc, - struct vmmc_module *module) -{ - list_del(&module->head); -} - -int vmmc_command_write(struct vmmc *vmmc, uint32_t cmd, - const uint32_t *data); -int vmmc_command_read(struct vmmc *vmmc, uint32_t cmd, uint32_t *result); - -struct vmmc_coder *vmmc_coder_get(struct vmmc *); -void vmmc_coder_put(struct vmmc *, struct vmmc_coder *); -void vmmc_init_coders(struct vmmc *); - -void vmmc_send_paket(struct vmmc *vmmc, unsigned int chan, struct sk_buff *skb); - -#endif diff --git a/package/lqtapi/src/tapi/Makefile b/package/lqtapi/src/tapi/Makefile deleted file mode 100644 index 2992d4b3a..000000000 --- a/package/lqtapi/src/tapi/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -tapi-objs := tapi-core.o tapi-port.o tapi-input.o -tapi-objs += tapi-control.o -tapi-objs += tapi-stream.o -tapi-objs += tapi-sysfs-port.o - -obj-m += tapi.o diff --git a/package/lqtapi/src/tapi/tapi-control.c b/package/lqtapi/src/tapi/tapi-control.c deleted file mode 100644 index a4f245e92..000000000 --- a/package/lqtapi/src/tapi/tapi-control.c +++ /dev/null @@ -1,193 +0,0 @@ -#include <linux/cdev.h> -#include <linux/device.h> -#include <linux/fs.h> -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/slab.h> - -#include <linux/tapi/tapi.h> -#include <linux/tapi/tapi-ioctl.h> - -/* FIXME Does it acutally make sense to allow more then one application at a - * time to open the control device? For example calling sync from one app will - * also sync all others. */ - -struct tapi_control_file { - struct tapi_device *tdev; - struct list_head links; -}; - -static struct tapi_endpoint *tapi_lookup_endpoint(struct tapi_device *tdev, - unsigned int ep_id) -{ - struct tapi_stream *stream; - - if (ep_id < tdev->num_ports) - return &tdev->ports[ep_id].ep; - - list_for_each_entry(stream, &tdev->streams, head) { - if (stream->ep.id == ep_id) - return &stream->ep; - } - - return ERR_PTR(-ENOENT); -} - -static inline struct tapi_device *inode_to_tdev(struct inode *inode) -{ - return container_of(inode->i_cdev, struct tapi_char_device, cdev)->tdev; -} - -static int tapi_control_open(struct inode *inode, struct file *file) -{ - int ret; - struct tapi_device *tdev = inode_to_tdev(inode); - struct tapi_control_file *tctrl; - - get_device(&tdev->dev); - - tctrl = kzalloc(sizeof(*tctrl), GFP_KERNEL); - if (!tctrl) { - ret = -ENOMEM; - goto err_put_device; - } - - INIT_LIST_HEAD(&tctrl->links); - tctrl->tdev = tdev; - - file->private_data = tctrl; - - return 0; - -err_put_device: - put_device(&tdev->dev); - - return ret; -} - -static int tapi_control_release(struct inode *inode, struct file *file) -{ - struct tapi_control_file *tctrl = file->private_data; - struct tapi_link *link; - - if (tctrl) { - list_for_each_entry(link, &tctrl->links, head) - tapi_link_free(tctrl->tdev, link); - - put_device(&tctrl->tdev->dev); - } - - return 0; -} - -static long tapi_control_ioctl_link_alloc(struct tapi_control_file *tctrl, - unsigned long arg) -{ - struct tapi_link *link; - struct tapi_endpoint *ep1, *ep2; - - ep1 = tapi_lookup_endpoint(tctrl->tdev, arg >> 16); - ep2 = tapi_lookup_endpoint(tctrl->tdev, arg & 0xffff); - - link = tapi_link_alloc(tctrl->tdev, ep1, ep2); - if (IS_ERR(link)) - return PTR_ERR(link); - - list_add_tail(&link->head, &tctrl->links); - - return link->id; -} - -struct tapi_link *tapi_control_lookup_link(struct tapi_control_file *tctrl, - unsigned int id) -{ - struct tapi_link *link; - - list_for_each_entry(link, &tctrl->links, head) { - if (link->id == id) - return link; - } - - return NULL; -} - -static long tapi_control_ioctl_link_free(struct tapi_control_file *tctrl, - unsigned long arg) -{ - struct tapi_link *link = tapi_control_lookup_link(tctrl, arg); - if (!link) - return -ENOENT; - - tapi_link_free(tctrl->tdev, link); - list_del(&link->head); - - return 0; -} - -static long tapi_control_ioctl_link_enable(struct tapi_control_file *tctrl, - unsigned long arg) -{ - struct tapi_link *link = tapi_control_lookup_link(tctrl, arg); - if (!link) - return -ENOENT; - - return tapi_link_enable(tctrl->tdev, link); -} - -static long tapi_control_ioctl_link_disable(struct tapi_control_file *tctrl, - unsigned long arg) -{ - struct tapi_link *link = tapi_control_lookup_link(tctrl, arg); - if (!link) - return -ENOENT; - - return tapi_link_disable(tctrl->tdev, link); -} - -static long tapi_control_ioctl_sync(struct tapi_control_file *tctrl) -{ - return tapi_sync(tctrl->tdev); -} - -static long tapi_control_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - struct tapi_control_file *tctrl = file->private_data; - - switch (cmd) { - case TAPI_CONTROL_IOCTL_LINK_ALLOC: - ret = tapi_control_ioctl_link_alloc(tctrl, arg); - break; - case TAPI_CONTROL_IOCTL_LINK_FREE: - ret = tapi_control_ioctl_link_free(tctrl, arg); - break; - case TAPI_CONTROL_IOCTL_LINK_ENABLE: - ret = tapi_control_ioctl_link_enable(tctrl, arg); - break; - case TAPI_CONTROL_IOCTL_LINK_DISABLE: - ret = tapi_control_ioctl_link_disable(tctrl, arg); - break; - case TAPI_CONTROL_IOCTL_SYNC: - ret = tapi_control_ioctl_sync(tctrl); - break; - default: - return -EINVAL; - } - - return ret; -} - -static const struct file_operations tapi_control_file_ops = { - .owner = THIS_MODULE, - .open = tapi_control_open, - .release = tapi_control_release, - .unlocked_ioctl = tapi_control_ioctl, -}; - -int tapi_register_control_device(struct tapi_device* tdev) -{ - dev_set_name(&tdev->control_dev.dev, "tapi%uC", tdev->id); - return tapi_char_device_register(tdev, &tdev->control_dev, &tapi_control_file_ops); -} diff --git a/package/lqtapi/src/tapi/tapi-core.c b/package/lqtapi/src/tapi/tapi-core.c deleted file mode 100644 index 2e112a376..000000000 --- a/package/lqtapi/src/tapi/tapi-core.c +++ /dev/null @@ -1,250 +0,0 @@ -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/device.h> -#include <linux/list.h> - -#include <linux/cdev.h> -#include <linux/err.h> - -#include <linux/tapi/tapi.h> - - -void tapi_alloc_input(struct tapi_device *tdev, struct tapi_port *port); -int tapi_register_port_device(struct tapi_device* tdev, struct tapi_port *port); -int tapi_register_stream_device(struct tapi_device* tdev); -int tapi_register_control_device(struct tapi_device* tdev); - -static struct class *tapi_class; -static int tapi_major; - -#define TAPI_MAX_MINORS 255 - -static bool tapi_minors[TAPI_MAX_MINORS]; - -static int tapi_get_free_minor(void) -{ - int i; - for (i = 0; i < TAPI_MAX_MINORS; ++i) { - if (!tapi_minors[i]) { - tapi_minors[i] = true; - return i; - } - } - - return -1; -} - -/* -int tapi_port_send_dtmf_events(struct tapi_device *tdev, unsigned int port, struct tapi_dtmf *, size_t num_events, unsigned int dealy) -{ -} -EXPORT_SYMBOL_GPL(tapi_port_send_dtmf_events); -*/ - -void tapi_report_hook_event(struct tapi_device *tdev, struct tapi_port *port, - bool on) -{ - struct tapi_event event; - event.type = TAPI_EVENT_TYPE_HOOK; - event.port = port->id; - event.hook.on = on; - - tapi_report_event(tdev, &event); -} -EXPORT_SYMBOL_GPL(tapi_report_hook_event); - -void tapi_report_dtmf_event(struct tapi_device *tdev, struct tapi_port *port, - unsigned char code) -{ - struct tapi_event event; - event.type = TAPI_EVENT_TYPE_DTMF; - event.port = port->id; - event.dtmf.code = code; - - tapi_report_event(tdev, &event); -} -EXPORT_SYMBOL_GPL(tapi_report_dtmf_event); - -struct tapi_stream *tapi_stream_alloc(struct tapi_device *tdev) -{ - struct tapi_stream *stream; - printk("tdev %p\n", tdev); - - if (!tdev->ops || !tdev->ops->stream_alloc) - return ERR_PTR(-ENOSYS); - - stream = tdev->ops->stream_alloc(tdev); - printk("stream %p\n", stream); - if (IS_ERR(stream)) - return stream; - - stream->id = atomic_inc_return(&tdev->stream_id) - 1; - stream->ep.id = stream->id; - -/* mutex_lock(&tdev->lock);*/ - list_add_tail(&stream->head, &tdev->streams); -/* mutex_unlock(&tdev->lock);*/ - - return stream; -} -EXPORT_SYMBOL_GPL(tapi_stream_alloc); - -void tapi_stream_free(struct tapi_device *tdev, struct tapi_stream *stream) -{ - mutex_lock(&tdev->lock); - list_del(&stream->head); - mutex_unlock(&tdev->lock); - - tdev->ops->stream_free(tdev, stream); -} -EXPORT_SYMBOL_GPL(tapi_stream_free); - -struct tapi_link *tapi_link_alloc(struct tapi_device *tdev, - struct tapi_endpoint *ep1, struct tapi_endpoint *ep2) -{ - struct tapi_link *link; - - if (!tdev->ops || !tdev->ops->link_alloc) - return ERR_PTR(-ENOSYS); - - link = tdev->ops->link_alloc(tdev, ep1, ep2); - if (IS_ERR(link)) - return link; - - link->id = atomic_inc_return(&tdev->link_id) - 1; - -/* - mutex_lock(&tdev->lock); - list_add_tail(&link->head, &tdev->links); - mutex_unlock(&tdev->lock); -*/ - return link; -} -EXPORT_SYMBOL_GPL(tapi_link_alloc); - -void tapi_link_free(struct tapi_device *tdev, struct tapi_link *link) -{ -/* - mutex_lock(&tdev->lock); - list_del(&link->head); - mutex_unlock(&tdev->lock); -*/ - tdev->ops->link_free(tdev, link); -} -EXPORT_SYMBOL_GPL(tapi_link_free); - -int tapi_char_device_register(struct tapi_device *tdev, - struct tapi_char_device *tchrdev, const struct file_operations *fops) -{ - int ret; - struct device *dev = &tchrdev->dev; - dev_t devt; - int minor = tapi_get_free_minor(); - - devt = MKDEV(tapi_major, minor); - - dev->devt = devt; - dev->class = tapi_class; - dev->parent = &tdev->dev; - - tchrdev->tdev = tdev; - - cdev_init(&tchrdev->cdev, fops); - tchrdev->cdev.owner = THIS_MODULE; - ret = cdev_add(&tchrdev->cdev, devt, 1); - if (ret) - return ret; - - ret = device_register(&tchrdev->dev); - if (ret) - goto err_cdev_del; - - return 0; - -err_cdev_del: - cdev_del(&tchrdev->cdev); - - return ret; -} - -int tapi_device_register(struct tapi_device *tdev, const char *name, - struct device *parent) -{ - static atomic_t tapi_device_id = ATOMIC_INIT(0); - int ret, i; - - tdev->dev.class = tapi_class; - tdev->dev.parent = parent; - dev_set_name(&tdev->dev, "%s", name); - - ret = device_register(&tdev->dev); - if (ret) - return ret; - - tdev->id = atomic_inc_return(&tapi_device_id) - 1; - - mutex_init(&tdev->lock); - INIT_LIST_HEAD(&tdev->streams); - INIT_LIST_HEAD(&tdev->links); - atomic_set(&tdev->link_id, 0); - atomic_set(&tdev->stream_id, tdev->num_ports); - - tapi_register_stream_device(tdev); - tapi_register_control_device(tdev); - - for (i = 0; i < tdev->num_ports; ++i) { - tapi_port_alloc(tdev, i); - tapi_alloc_input(tdev, &tdev->ports[i]); - tapi_register_port_device(tdev, &tdev->ports[i]); - tdev->ports[i].id = i; - tdev->ports[i].ep.id = i; - } - - return 0; -} -EXPORT_SYMBOL_GPL(tapi_device_register); - -void tapi_device_unregister(struct tapi_device *tdev) -{ - device_unregister(&tdev->dev); -} -EXPORT_SYMBOL_GPL(tapi_device_unregister); - -static int __init tapi_class_init(void) -{ - int ret; - dev_t dev; - - tapi_class = class_create(THIS_MODULE, "tapi"); - - if (IS_ERR(tapi_class)) { - ret = PTR_ERR(tapi_class); - printk(KERN_ERR "tapi: Failed to create device class: %d\n", ret); - goto err; - } - - ret = alloc_chrdev_region(&dev, 0, TAPI_MAX_MINORS, "tapi"); - if (ret) { - printk(KERN_ERR "tapi: Failed to allocate chrdev region: %d\n", ret); - goto err_class_destory; - } - tapi_major = MAJOR(dev); - - return 0; -err_class_destory: - class_destroy(tapi_class); -err: - return ret; -} -subsys_initcall(tapi_class_init); - -static void __exit tapi_class_exit(void) -{ - unregister_chrdev_region(MKDEV(tapi_major, 0), TAPI_MAX_MINORS); - class_destroy(tapi_class); -} -module_exit(tapi_class_exit); - -MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); -MODULE_DESCRIPTION("TAPI class"); -MODULE_LICENSE("GPL"); diff --git a/package/lqtapi/src/tapi/tapi-input.c b/package/lqtapi/src/tapi/tapi-input.c deleted file mode 100644 index 999aaefa9..000000000 --- a/package/lqtapi/src/tapi/tapi-input.c +++ /dev/null @@ -1,99 +0,0 @@ - -#include <linux/tapi/tapi.h> - -#include <linux/input.h> - -static unsigned short tapi_keycodes[] = { - [0] = KEY_NUMERIC_0, - [1] = KEY_NUMERIC_1, - [2] = KEY_NUMERIC_2, - [3] = KEY_NUMERIC_3, - [4] = KEY_NUMERIC_4, - [5] = KEY_NUMERIC_5, - [6] = KEY_NUMERIC_6, - [7] = KEY_NUMERIC_7, - [8] = KEY_NUMERIC_8, - [9] = KEY_NUMERIC_9, - [10] = KEY_NUMERIC_STAR, - [11] = KEY_NUMERIC_POUND, - [12] = KEY_ENTER, - [13] = KEY_ESC, -}; - -static int tapi_input_event(struct input_dev *input, unsigned int type, - unsigned int code, int value) -{ - struct tapi_device *tdev = dev_to_tapi(input->dev.parent); - struct tapi_port *port = input_get_drvdata(input); - - - if (type != EV_SND || code != SND_BELL) - return -EINVAL; - - tapi_port_set_ring(tdev, port, value); - - return 0; -} - -void tapi_alloc_input(struct tapi_device *tdev, struct tapi_port *port) -{ - struct input_dev *input; - int i; - char *phys; - - input = input_allocate_device(); - - phys = kzalloc(sizeof("tapi/input000"), GFP_KERNEL); - sprintf(phys, "tapi/input%d", port->id); - - input->name = "tapi"; - input->phys = phys; - input->id.bustype = BUS_HOST; - input->dev.parent = &tdev->dev; - input->evbit[0] = BIT(EV_KEY) | BIT(EV_SND); - input->sndbit[0] = BIT(SND_BELL); - - input->event = tapi_input_event; - - input->keycodesize = sizeof(unsigned short); - input->keycodemax = ARRAY_SIZE(tapi_keycodes); - input->keycode = tapi_keycodes; - - port->input = input; - - for (i = 0; i < ARRAY_SIZE(tapi_keycodes); ++i) - __set_bit(tapi_keycodes[i], input->keybit); - - input_set_drvdata(input, port); - input_register_device(input); -} - -void tapi_report_event(struct tapi_device *tdev, - struct tapi_event *event) -{ - unsigned short key_code; - struct input_dev *input; - - if (!tdev || !tdev->ports) - return; - - switch (event->type) { - case TAPI_EVENT_TYPE_HOOK: - if (event->hook.on) - key_code = KEY_ENTER; - else - key_code = KEY_ESC; - break; - case TAPI_EVENT_TYPE_DTMF: - key_code = tapi_keycodes[event->dtmf.code]; - break; - default: - return; - } - - input = tdev->ports[event->port].input; - input_report_key(input, key_code, 1); - input_sync(input); - input_report_key(input, key_code, 0); - input_sync(input); -} diff --git a/package/lqtapi/src/tapi/tapi-nl.c b/package/lqtapi/src/tapi/tapi-nl.c deleted file mode 100644 index c066742b6..000000000 --- a/package/lqtapi/src/tapi/tapi-nl.c +++ /dev/null @@ -1,62 +0,0 @@ - -static struct tapi_attr default_port[] = { - [PORTS] = { - .type = TAPI_TYPE_PORTS, - .name = "ports", - .description = "foobar", - .set = tapi_set_ports, - .get = tapi_get_ports, - }, -}; - -static const struct nla_policy tapi_policy[] = { - [TAPI_ATTR_ID] = { .type = NLA_U32 }, - [TAPI_ATTR_PORT] = { .type = NLA_U32 }, - [TAPI_ATTR_ENDPOINT] = { .type = NLA_U32 }, - [TAPI_ATTR_STREAM] = { .type = NLA_U32 } -}; - -static const struct nla_policy tapi_port_policy[] = { - [TAPI_PORT_ID] = { .type = NLA_U32 }, -}; - -static const struct nla_policy tapi_endpoint_policy[] = { - [TAPI_ENDPOINT_ID] = { .type = NLA_U32 }, -}; - -static const struct nla_policy tapi_stream_policy[] = { - [TAPI_STREAM_ID] = { .type = NLA_U32 }, -}; - -static struct genl_family tapi_nl_family = { - .id = GENL_ID_GENERATE, - .name = "tapi", - .hdrsize = 0, - .version = 1, - .maxattr = ARRAY_SIZE(tapi_policy), -}; - - - -static struct genl_ops tapi_nl_ops[] = { - TAPI_NL_OP(TAPI_CMD_LIST, list_attr), - -}; - -static int __init tapi_nl_init(void) -{ - ret = genl_unregister_family(&tapi_nl_family); - if (ret) - return ret; - - genl_register_ops(&tapi_nl_family, tapi_nl_ops); - - return 0; -} -module_init(tapi_nl_init); - -static void __exit tapi_nl_exit(void) -{ - genl_unregister_family(&tapi_nl_family); -} - diff --git a/package/lqtapi/src/tapi/tapi-port.c b/package/lqtapi/src/tapi/tapi-port.c deleted file mode 100644 index 0ef955567..000000000 --- a/package/lqtapi/src/tapi/tapi-port.c +++ /dev/null @@ -1,82 +0,0 @@ -#include <linux/cdev.h> -#include <linux/fs.h> -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/slab.h> - -#include <linux/tapi/tapi.h> -#include <linux/tapi/tapi-ioctl.h> - -static inline struct tapi_port *tapi_char_device_to_port(struct tapi_char_device *chrdev) -{ - return container_of(chrdev, struct tapi_port, chrdev); -} - -static int tapi_port_open(struct inode *inode, struct file *file) -{ - struct tapi_device *tdev = cdev_to_tapi_char_device(inode->i_cdev)->tdev; - - get_device(&tdev->dev); - file->private_data = cdev_to_tapi_char_device(inode->i_cdev); - - return 0; -} - -static int tapi_port_release(struct inode *inode, struct file *file) -{ - struct tapi_device *tdev = cdev_to_tapi_char_device(inode->i_cdev)->tdev; - - put_device(&tdev->dev); - - return 0; -} - -static long tapi_port_ioctl_get_endpoint(struct tapi_device *tdev, - struct tapi_port *port, unsigned long arg) -{ - return port->ep.id; -} - -static long tapi_port_ioctl_set_ring(struct tapi_device *tdev, - struct tapi_port *port, unsigned long arg) -{ - tapi_port_set_ring(tdev, port, arg); - return 0; -} - -static long tapi_port_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - struct tapi_char_device *tchrdev = file->private_data; - struct tapi_device *tdev = tchrdev->tdev; - struct tapi_port *port = tapi_char_device_to_port(tchrdev); - - switch (cmd) { - case TAPI_PORT_IOCTL_GET_ENDPOINT: - ret = tapi_port_ioctl_get_endpoint(tdev, port, arg); - break; - case TAPI_PORT_IOCTL_SET_RING: - ret = tapi_port_ioctl_set_ring(tdev, port, arg); - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - -static const struct file_operations tapi_port_file_ops = { - .owner = THIS_MODULE, - .open = tapi_port_open, - .release = tapi_port_release, - .unlocked_ioctl = tapi_port_ioctl, -}; - -int tapi_register_port_device(struct tapi_device* tdev, struct tapi_port *port) -{ - dev_set_name(&port->chrdev.dev, "tapi%uP%u", tdev->id, port->id); - return tapi_char_device_register(tdev, &port->chrdev, &tapi_port_file_ops); -} diff --git a/package/lqtapi/src/tapi/tapi-stream.c b/package/lqtapi/src/tapi/tapi-stream.c deleted file mode 100644 index 7277a5c61..000000000 --- a/package/lqtapi/src/tapi/tapi-stream.c +++ /dev/null @@ -1,201 +0,0 @@ -#include <linux/cdev.h> -#include <linux/device.h> -#include <linux/fs.h> -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/slab.h> -#include <linux/signal.h> -#include <linux/sched.h> -#include <linux/poll.h> - -#include <linux/tapi/tapi.h> -#include <linux/tapi/tapi-ioctl.h> - - -struct tapi_stream_file { - struct tapi_device *tdev; - struct tapi_stream *stream; -}; - -static inline struct tapi_device *inode_to_tdev(struct inode *inode) -{ - return container_of(inode->i_cdev, struct tapi_char_device, cdev)->tdev; -} - -static int tapi_stream_open(struct inode *inode, struct file *file) -{ - int ret; - struct tapi_device *tdev = inode_to_tdev(inode); - struct tapi_stream_file *stream; - - get_device(&tdev->dev); - - stream = kzalloc(sizeof(*stream), GFP_KERNEL); - if (!stream) { - ret = -ENOMEM; - goto err_put; - } - - stream->stream = tapi_stream_alloc(tdev); - if (IS_ERR(stream->stream)) { - ret = PTR_ERR(stream->stream); - goto err_free; - } - stream->tdev = tdev; - - init_waitqueue_head(&stream->stream->recv_wait); - skb_queue_head_init(&stream->stream->recv_queue); - - file->private_data = stream; - - return 0; - -err_free: - kfree(stream); -err_put: - put_device(&tdev->dev); - return ret; -} - -static int tapi_stream_release(struct inode *inode, struct file *file) -{ - struct tapi_stream_file *stream = file->private_data; - - if (stream) { - tapi_stream_free(stream->tdev, stream->stream); - put_device(&stream->tdev->dev); - kfree(stream); - } - - return 0; -} - -static long tapi_stream_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret = 0; - struct tapi_stream_file *stream = file->private_data; - struct tapi_device *tdev = stream->tdev; - - switch (cmd) { - case TAPI_STREAM_IOCTL_GET_ENDPOINT: - ret = stream->stream->ep.id; - break; - case TAPI_STREAM_IOCTL_CONFIGURE: - break; - case TAPI_STREAM_IOCTL_START: - ret = tapi_stream_start(tdev, stream->stream); - break; - case TAPI_STREAM_IOCTL_STOP: - ret = tapi_stream_stop(tdev, stream->stream); - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - -static unsigned int tapi_stream_poll(struct file *file, struct poll_table_struct *wait) -{ - struct tapi_stream_file *stream = file->private_data; - int ret; - - poll_wait(file, &stream->stream->recv_wait, wait); - - ret = POLLOUT; - - if (!skb_queue_empty(&stream->stream->recv_queue)) - ret |= POLLIN; - - return ret; -} - -static ssize_t tapi_stream_read(struct file *file, char __user *buffer, - size_t count, loff_t *offset) -{ - struct tapi_stream_file *stream = file->private_data; - struct sk_buff *skb; - - skb = skb_dequeue(&stream->stream->recv_queue); - if (!skb) { - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - - do { - interruptible_sleep_on(&stream->stream->recv_wait); - skb = skb_dequeue(&stream->stream->recv_queue); - } while (skb == NULL && !signal_pending(current)); - - if (skb == NULL) - return -ERESTARTNOHAND; - } - - if (skb->len > count) { - skb_queue_head(&stream->stream->recv_queue, skb); - return -EMSGSIZE; - } - - if (copy_to_user(buffer, skb->data, skb->len)) { - skb_queue_head(&stream->stream->recv_queue, skb); - return -EFAULT; - } - - count = skb->len; - - kfree_skb(skb); - - return count; -} - -static ssize_t tapi_stream_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct tapi_stream_file *stream = file->private_data; - struct tapi_device *tdev = stream->tdev; - struct sk_buff *skb; - - if (count == 0) - return 0; - - skb = alloc_skb(count, GFP_USER); - if (!skb) - return -ENOMEM; - - if (copy_from_user(skb_put(skb, count), buffer, count)) { - kfree_skb(skb); - return -EFAULT; - } - - tdev->ops->stream_send(tdev, stream->stream, skb); - - return count; -} - -static const struct file_operations tapi_stream_file_ops = { - .owner = THIS_MODULE, - .read = tapi_stream_read, - .write = tapi_stream_write, - .open = tapi_stream_open, - .release = tapi_stream_release, - .poll = tapi_stream_poll, - .unlocked_ioctl = tapi_stream_ioctl, -}; - -int tapi_register_stream_device(struct tapi_device* tdev) -{ - dev_set_name(&tdev->stream_dev.dev, "tapi%uS", tdev->id); - return tapi_char_device_register(tdev, &tdev->stream_dev, &tapi_stream_file_ops); -} - -int tapi_stream_recv(struct tapi_device *tdev, struct tapi_stream * stream, - struct sk_buff *skb) -{ - skb_queue_tail(&stream->recv_queue, skb); - wake_up(&stream->recv_wait); - - return 0; -} -EXPORT_SYMBOL_GPL(tapi_stream_recv); diff --git a/package/lqtapi/src/tapi/tapi-sysfs-port.c b/package/lqtapi/src/tapi/tapi-sysfs-port.c deleted file mode 100644 index f6e5ee066..000000000 --- a/package/lqtapi/src/tapi/tapi-sysfs-port.c +++ /dev/null @@ -1,107 +0,0 @@ -#include <linux/device.h> -#include <linux/kernel.h> -#include <linux/sysfs.h> - -#include <linux/err.h> -#include <linux/tapi/tapi.h> - -struct tapi_sysfs_port { - struct tapi_device *tdev; - unsigned int id; - struct kobject kobj; -}; - -struct tapi_sysfs_entry { - ssize_t (*show)(struct tapi_device *, unsigned int port, char *); - ssize_t (*store)(struct tapi_device *, unsigned int port, const char *, size_t); - struct attribute attr; -}; - -static ssize_t tapi_port_store(struct kobject *kobj, struct attribute *attr, - const char *s, size_t len) -{ - struct tapi_sysfs_port *port = container_of(kobj, struct tapi_sysfs_port, kobj); - struct tapi_sysfs_entry *entry = container_of(attr, struct tapi_sysfs_entry, - attr); - - if (!entry->store) - return -ENOSYS; - - return entry->store(port->tdev, port->id, s, len); -} - -static ssize_t tapi_port_show(struct kobject *kobj, struct attribute *attr, - char *s) -{ - return -ENOSYS; -} - -#define TAPI_PORT_ATTR(_name, _mode, _show, _store) \ - struct tapi_sysfs_entry tapi_port_ ## _name ## _attr = \ - __ATTR(_name, _mode, _show, _store) - -static int tapi_port_store_ring(struct tapi_device *tdev, unsigned int port, - const char *s, size_t len) -{ - int ret; - unsigned long val; - - ret = strict_strtoul(s, 10, &val); - - if (ret) - return ret; - - ret = tapi_port_set_ring(tdev, &tdev->ports[port], val); - if (ret) - return ret; - return len; -} - -static TAPI_PORT_ATTR(ring, 0644, NULL, tapi_port_store_ring); - -static struct attribute *tapi_port_default_attrs[] = { - &tapi_port_ring_attr.attr, - NULL, -}; - -static void tapi_port_free(struct kobject *kobj) -{ - struct tapi_sysfs_port *port = container_of(kobj, struct tapi_sysfs_port, kobj); - kfree(port); -} - -static struct sysfs_ops tapi_port_sysfs_ops = { - .show = tapi_port_show, - .store = tapi_port_store, -}; - -static struct kobj_type tapi_port_ktype = { - .release = tapi_port_free, - .sysfs_ops = &tapi_port_sysfs_ops, - .default_attrs = tapi_port_default_attrs, -}; - -struct tapi_sysfs_port *tapi_port_alloc(struct tapi_device *tdev, unsigned int id) -{ - struct tapi_sysfs_port *port; - int ret; - - port = kzalloc(sizeof(*port), GFP_KERNEL); - port->tdev = tdev; - port->id = id; - - ret = kobject_init_and_add(&port->kobj, &tapi_port_ktype, &tdev->dev.kobj, - "port%d", id); - if (ret) { - kfree(port); - return ERR_PTR(ret); - } - - return port; -} - -void tapi_port_delete(struct tapi_sysfs_port *port) -{ - kobject_del(&port->kobj); - kobject_put(&port->kobj); -} diff --git a/package/ltq-dsl/Makefile b/package/ltq-dsl/Makefile index 6f8f6ba0c..f62bfe884 100644 --- a/package/ltq-dsl/Makefile +++ b/package/ltq-dsl/Makefile @@ -155,12 +155,12 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_cmv_danube.h $(1)/usr/include endef -define Package/ltq-dsl-firmware-a/install +define Package/kmod-ltq-dsl-firmware-a/install $(INSTALL_DIR) $(1)/lib/firmware/ $(CP) $(PKG_BUILD_DIR)/$(FW_BASE_NAME)_a_$(FW_A_FILE_VER).bin $(1)/lib/firmware/ModemHWE.bin endef -define Package/ltq-dsl-firmware-b/install +define Package/kmod-ltq-dsl-firmware-b/install $(INSTALL_DIR) $(1)/lib/firmware/ $(CP) $(PKG_BUILD_DIR)/$(FW_BASE_NAME)_b_$(FW_B_FILE_VER).bin $(1)/lib/firmware/ModemHWE.bin endef diff --git a/package/ltq-dsl/patches/500-portability.patch b/package/ltq-dsl/patches/500-portability.patch index 48e9d173d..d74314c77 100644 --- a/package/ltq-dsl/patches/500-portability.patch +++ b/package/ltq-dsl/patches/500-portability.patch @@ -1,7 +1,5 @@ -Index: drv_dsl_cpe_api-3.24.4.4/configure.in -=================================================================== ---- drv_dsl_cpe_api-3.24.4.4.orig/configure.in 2009-08-13 13:39:21.000000000 +0200 -+++ drv_dsl_cpe_api-3.24.4.4/configure.in 2010-10-14 02:14:55.000000000 +0200 +--- a/configure.in ++++ b/configure.in @@ -310,7 +310,7 @@ AC_ARG_ENABLE(kernelbuild, AC_HELP_STRING(--enable-kernel-build=x,Set the target kernel build path), @@ -167,10 +165,8 @@ Index: drv_dsl_cpe_api-3.24.4.4/configure.in ]) AC_CONFIG_FILES([Makefile src/Makefile]) -Index: drv_dsl_cpe_api-3.24.4.4/src/Makefile.am -=================================================================== ---- drv_dsl_cpe_api-3.24.4.4.orig/src/Makefile.am 2009-07-03 14:06:34.000000000 +0200 -+++ drv_dsl_cpe_api-3.24.4.4/src/Makefile.am 2010-10-14 02:14:55.000000000 +0200 +--- a/src/Makefile.am ++++ b/src/Makefile.am @@ -303,7 +303,7 @@ drv_dsl_cpe_api_OBJS = "$(subst .c,.o,$(filter %.c,$(drv_dsl_cpe_api_SOURCES)))" @@ -195,10 +191,8 @@ Index: drv_dsl_cpe_api-3.24.4.4/src/Makefile.am $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules clean-generic: -Index: drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_linux.h -=================================================================== ---- drv_dsl_cpe_api-3.24.4.4.orig/src/include/drv_dsl_cpe_os_linux.h 2010-10-14 02:14:55.000000000 +0200 -+++ drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_linux.h 2010-10-14 02:14:55.000000000 +0200 +--- a/src/include/drv_dsl_cpe_os_linux.h ++++ b/src/include/drv_dsl_cpe_os_linux.h @@ -16,8 +16,6 @@ extern "C" { #endif @@ -208,10 +202,25 @@ Index: drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_linux.h #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -@@ -40,6 +38,7 @@ +@@ -26,8 +24,10 @@ + #include <linux/spinlock.h> + #include <linux/sched.h> + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- #include <generated/utsrelease.h> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) ++#include <linux/utsrelease.h> ++#else ++#include <generated/utsrelease.h> + #endif + + #include <linux/types.h> +@@ -39,7 +39,8 @@ + #include <linux/delay.h> #include <linux/poll.h> #include <asm/uaccess.h> - #include <linux/smp_lock.h> +-#include <linux/smp_lock.h> ++//#include <linux/smp_lock.h> +#include <asm/ioctl.h> #ifdef INCLUDE_DSL_CPE_API_IFXOS_SUPPORT diff --git a/package/ltq-dsl/src/ifxmips_atm_core.c b/package/ltq-dsl/src/ifxmips_atm_core.c index 55062d745..49a31fc59 100644 --- a/package/ltq-dsl/src/ifxmips_atm_core.c +++ b/package/ltq-dsl/src/ifxmips_atm_core.c @@ -59,8 +59,7 @@ /* * Chip Specific Head File */ -#include <lantiq.h> -#include <lantiq_regs.h> +#include <lantiq_soc.h> #include "ifxmips_atm_core.h" @@ -2403,7 +2402,11 @@ static int __devinit ifx_atm_init(void) /* create devices */ for ( port_num = 0; port_num < ATM_PORT_NUMBER; port_num++ ) { - g_atm_priv_data.port[port_num].dev = atm_dev_register("ifxmips_atm", NULL, &g_ifx_atm_ops, -1, NULL); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) + g_atm_priv_data.port[port_num].dev = atm_dev_register("ifxmips_atm", &g_ifx_atm_ops, -1, NULL); +#else + g_atm_priv_data.port[port_num].dev = atm_dev_register("ifxmips_atm", NULL, &g_ifx_atm_ops, -1, NULL); +#endif if ( !g_atm_priv_data.port[port_num].dev ) { err("failed to register atm device %d!", port_num); ret = -EIO; diff --git a/package/ltq-dsl/src/ifxmips_atm_danube.c b/package/ltq-dsl/src/ifxmips_atm_danube.c index 5698e0877..583b5646b 100644 --- a/package/ltq-dsl/src/ifxmips_atm_danube.c +++ b/package/ltq-dsl/src/ifxmips_atm_danube.c @@ -45,8 +45,7 @@ /* * Chip Specific Head File */ -#include <lantiq.h> -#include <lantiq_regs.h> +#include <lantiq_soc.h> #include "ifxmips_compat.h" #include "ifxmips_atm_core.h" #include "ifxmips_atm_fw_danube.h" diff --git a/package/ltq-dsl/src/ifxmips_atm_ppe_danube.h b/package/ltq-dsl/src/ifxmips_atm_ppe_danube.h index a60abe1d5..34cf87705 100644 --- a/package/ltq-dsl/src/ifxmips_atm_ppe_danube.h +++ b/package/ltq-dsl/src/ifxmips_atm_ppe_danube.h @@ -93,7 +93,7 @@ /* * Mailbox IGU1 Interrupt */ -#define PPE_MAILBOX_IGU1_INT LQ_PPE_MBOX_INT +#define PPE_MAILBOX_IGU1_INT LTQ_PPE_MBOX_INT diff --git a/package/ltq-dsl/src/ifxmips_compat.h b/package/ltq-dsl/src/ifxmips_compat.h index f5b576846..ae375b7e6 100644 --- a/package/ltq-dsl/src/ifxmips_compat.h +++ b/package/ltq-dsl/src/ifxmips_compat.h @@ -26,7 +26,7 @@ #define IFX_PMU_MODULE_PPE_EMA (1 << 22) #define IFX_PMU_MODULE_PPE_TOP (1 << 29) -#define ifx_pmu_set(a,b) {if(a == IFX_PMU_ENABLE) lq_pmu_enable(b); else lq_pmu_disable(b);} +#define ifx_pmu_set(a,b) {if(a == IFX_PMU_ENABLE) ltq_pmu_enable(b); else ltq_pmu_disable(b);} #define PPE_TOP_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_TOP, (__x)) #define PPE_SLL01_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_SLL01, (__x)) diff --git a/package/ltq-dsl/src/lantiq_mei.c b/package/ltq-dsl/src/lantiq_mei.c index c236fa9dd..ac818929c 100644 --- a/package/ltq-dsl/src/lantiq_mei.c +++ b/package/ltq-dsl/src/lantiq_mei.c @@ -29,7 +29,11 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/version.h> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) +#include <linux/utsrelease.h> +#else #include <generated/utsrelease.h> +#endif #include <linux/types.h> #include <linux/fs.h> #include <linux/mm.h> @@ -46,22 +50,21 @@ #include <asm/uaccess.h> #include <asm/hardirq.h> -#include <lantiq.h> -#include <lantiq_regs.h> +#include <lantiq_soc.h> #include "ifxmips_atm.h" #define IFX_MEI_BSP #include "ifxmips_mei_interface.h" -/*#define LQ_RCU_RST IFX_RCU_RST_REQ -#define LQ_RCU_RST_REQ_ARC_JTAG IFX_RCU_RST_REQ_ARC_JTAG -#define LQ_RCU_RST_REQ_DFE IFX_RCU_RST_REQ_DFE -#define LQ_RCU_RST_REQ_AFE IFX_RCU_RST_REQ_AFE +/*#define LTQ_RCU_RST IFX_RCU_RST_REQ +#define LTQ_RCU_RST_REQ_ARC_JTAG IFX_RCU_RST_REQ_ARC_JTAG +#define LTQ_RCU_RST_REQ_DFE IFX_RCU_RST_REQ_DFE +#define LTQ_RCU_RST_REQ_AFE IFX_RCU_RST_REQ_AFE #define IFXMIPS_FUSE_BASE_ADDR IFX_FUSE_BASE_ADDR #define IFXMIPS_ICU_IM0_IER IFX_ICU_IM0_IER #define IFXMIPS_ICU_IM2_IER IFX_ICU_IM2_IER -#define LQ_MEI_INT IFX_MEI_INT -#define LQ_MEI_DYING_GASP_INT IFX_MEI_DYING_GASP_INT -#define LQ_MEI_BASE_ADDR IFX_MEI_SPACE_ACCESS +#define LTQ_MEI_INT IFX_MEI_INT +#define LTQ_MEI_DYING_GASP_INT IFX_MEI_DYING_GASP_INT +#define LTQ_MEI_BASE_ADDR IFX_MEI_SPACE_ACCESS #define IFXMIPS_PMU_PWDCR IFX_PMU_PWDCR #define IFXMIPS_MPS_CHIPID IFX_MPS_CHIPID @@ -73,40 +76,44 @@ #define ifxmips_port_free_pin ifx_gpio_pin_free #define ifxmips_mask_and_ack_irq bsp_mask_and_ack_irq #define IFXMIPS_MPS_CHIPID_VERSION_GET IFX_MCD_CHIPID_VERSION_GET -#define lq_r32(reg) __raw_readl(reg) -#define lq_w32(val, reg) __raw_writel(val, reg) -#define lq_w32_mask(clear, set, reg) lq_w32((lq_r32(reg) & ~clear) | set, reg) +#define ltq_r32(reg) __raw_readl(reg) +#define ltq_w32(val, reg) __raw_writel(val, reg) +#define ltq_w32_mask(clear, set, reg) ltq_w32((ltq_r32(reg) & ~clear) | set, reg) */ -#define LQ_RCU_RST_REQ_DFE (1 << 7) -#define LQ_RCU_RST_REQ_AFE (1 << 11) -#define LQ_PMU_PWDCR ((u32 *)(LQ_PMU_BASE_ADDR + 0x001C)) -#define LQ_PMU_PWDSR ((u32 *)(LQ_PMU_BASE_ADDR + 0x0020)) -#define LQ_RCU_RST ((u32 *)(LQ_RCU_BASE_ADDR + 0x0010)) -#define LQ_RCU_RST_ALL 0x40000000 -#define LQ_ICU_BASE_ADDR (KSEG1 | 0x1F880200) +#define LTQ_RCU_RST_REQ_DFE (1 << 7) +#define LTQ_RCU_RST_REQ_AFE (1 << 11) + +#define LTQ_PMU_BASE (KSEG1 + LTQ_PMU_BASE_ADDR) +#define LTQ_RCU_BASE (KSEG1 + LTQ_RCU_BASE_ADDR) +#define LTQ_ICU_BASE (KSEG1 + LTQ_ICU_BASE_ADDR) -#define LQ_ICU_IM0_ISR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0000)) -#define LQ_ICU_IM0_IER ((u32 *)(LQ_ICU_BASE_ADDR + 0x0008)) -#define LQ_ICU_IM0_IOSR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0010)) -#define LQ_ICU_IM0_IRSR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0018)) -#define LQ_ICU_IM0_IMR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0020)) +#define LTQ_PMU_PWDCR ((u32 *)(LTQ_PMU_BASE + 0x001C)) +#define LTQ_PMU_PWDSR ((u32 *)(LTQ_PMU_BASE + 0x0020)) +#define LTQ_RCU_RST ((u32 *)(LTQ_RCU_BASE + 0x0010)) +#define LTQ_RCU_RST_ALL 0x40000000 +#define LTQ_ICU_IM0_ISR ((u32 *)(LTQ_ICU_BASE + 0x0000)) +#define LTQ_ICU_IM0_IER ((u32 *)(LTQ_ICU_BASE + 0x0008)) +#define LTQ_ICU_IM0_IOSR ((u32 *)(LTQ_ICU_BASE + 0x0010)) +#define LTQ_ICU_IM0_IRSR ((u32 *)(LTQ_ICU_BASE + 0x0018)) +#define LTQ_ICU_IM0_IMR ((u32 *)(LTQ_ICU_BASE + 0x0020)) -#define LQ_ICU_IM1_ISR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0028)) -#define LQ_ICU_IM2_ISR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0050)) -#define LQ_ICU_IM3_ISR ((u32 *)(LQ_ICU_BASE_ADDR + 0x0078)) -#define LQ_ICU_IM4_ISR ((u32 *)(LQ_ICU_BASE_ADDR + 0x00A0)) -#define LQ_ICU_OFFSET (LQ_ICU_IM1_ISR - LQ_ICU_IM0_ISR) -#define LQ_ICU_IM2_IER (LQ_ICU_IM0_IER + LQ_ICU_OFFSET) +#define LTQ_ICU_IM1_ISR ((u32 *)(LTQ_ICU_BASE + 0x0028)) +#define LTQ_ICU_IM2_ISR ((u32 *)(LTQ_ICU_BASE + 0x0050)) +#define LTQ_ICU_IM3_ISR ((u32 *)(LTQ_ICU_BASE + 0x0078)) +#define LTQ_ICU_IM4_ISR ((u32 *)(LTQ_ICU_BASE + 0x00A0)) + +#define LTQ_ICU_OFFSET (LTQ_ICU_IM1_ISR - LTQ_ICU_IM0_ISR) +#define LTQ_ICU_IM2_IER (LTQ_ICU_IM0_IER + LTQ_ICU_OFFSET) #define IFX_MEI_EMSG(fmt, args...) pr_err("[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) #define IFX_MEI_DMSG(fmt, args...) pr_debug("[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) -#define LQ_FUSE_BASE (KSEG1 + 0x1F107354) +#define LTQ_FUSE_BASE (KSEG1 + 0x1F107354) -#ifdef CONFIG_LQ_MEI_FW_LOOPBACK +#ifdef CONFIG_LTQ_MEI_FW_LOOPBACK //#define DFE_MEM_TEST //#define DFE_PING_TEST #define DFE_ATM_LOOPBACK @@ -193,9 +200,18 @@ static void *g_xdata_addr = NULL; static u32 *mei_arc_swap_buff = NULL; // holding swap pages -extern void lq_mask_and_ack_irq(unsigned int irq_nr); -#define MEI_MASK_AND_ACK_IRQ lq_mask_and_ack_irq - +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) +extern void ltq_mask_and_ack_irq(unsigned int irq_nr); +#define MEI_MASK_AND_ACK_IRQ ltq_mask_and_ack_irq +#else +extern void ltq_mask_and_ack_irq(struct irq_data *d); +static void inline MEI_MASK_AND_ACK_IRQ(int x) +{ + struct irq_data d; + d.irq = x; + ltq_mask_and_ack_irq(&d); +} +#endif #define MEI_MAJOR 105 static int dev_major = MEI_MAJOR; @@ -704,9 +720,9 @@ IFX_MEI_FuseProg (DSL_DEV_Device_t * pDev) u32 reg_data, fuse_value; int i = 0; - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); while ((reg_data & 0x10000000) == 0) { - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); i++; /* 0x4000 translate to about 16 ms@111M, so should be enough */ if (i == 0x4000) @@ -714,12 +730,12 @@ IFX_MEI_FuseProg (DSL_DEV_Device_t * pDev) } // STEP a: Prepare memory for external accesses // Write fuse_en bit24 - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); - IFX_MEI_LongWordWrite ((u32) LQ_RCU_RST, reg_data | (1 << 24)); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) LTQ_RCU_RST, reg_data | (1 << 24)); IFX_MEI_FuseInit (pDev); for (i = 0; i < 4; i++) { - IFX_MEI_LongWordRead ((u32) (LQ_FUSE_BASE) + i * 4, &fuse_value); + IFX_MEI_LongWordRead ((u32) (LTQ_FUSE_BASE) + i * 4, &fuse_value); switch (fuse_value & 0xF0000) { case 0x80000: reg_data = ((fuse_value & RX_DILV_ADDR_BIT_MASK) | @@ -765,9 +781,9 @@ IFX_MEI_FuseProg (DSL_DEV_Device_t * pDev) break; } } - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); - IFX_MEI_LongWordWrite ((u32) LQ_RCU_RST, reg_data & ~(1 << 24)); - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) LTQ_RCU_RST, reg_data & ~(1 << 24)); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); } /** @@ -868,9 +884,9 @@ IFX_MEI_ResetARC (DSL_DEV_Device_t * pDev) IFX_MEI_HaltArc (pDev); - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, &arc_debug_data); - IFX_MEI_LongWordWrite ((u32) LQ_RCU_RST, - arc_debug_data | LQ_RCU_RST_REQ_DFE | LQ_RCU_RST_REQ_AFE); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, &arc_debug_data); + IFX_MEI_LongWordWrite ((u32) LTQ_RCU_RST, + arc_debug_data | LTQ_RCU_RST_REQ_DFE | LTQ_RCU_RST_REQ_AFE); // reset ARC IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_RST_CTRL, MEI_SOFT_RESET); @@ -1034,8 +1050,8 @@ IFX_MEI_ArcJtagEnable (DSL_DEV_Device_t *dev, int enable) ifxmips_port_clear_altsel1(0, 11); ifxmips_port_set_open_drain(0, 11); //enable ARC JTAG - IFX_MEI_LongWordRead ((u32) LQ_RCU_RST, ®_data); - IFX_MEI_LongWordWrite ((u32) LQ_RCU_RST, reg_data | LQ_RCU_RST_REQ_ARC_JTAG); + IFX_MEI_LongWordRead ((u32) LTQ_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) LTQ_RCU_RST, reg_data | LTQ_RCU_RST_REQ_ARC_JTAG); break; case 0: default: @@ -1045,8 +1061,6 @@ jtag_end: if (meierr) return DSL_DEV_MEI_ERR_FAILURE; */ - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); return DSL_DEV_MEI_ERR_SUCCESS; }; @@ -1333,17 +1347,17 @@ IFX_MEI_RunAdslModem (DSL_DEV_Device_t *pDev) IFX_MEI_DownloadBootCode (pDev); - im0_register = (*LQ_ICU_IM0_IER) & (1 << 20); - im2_register = (*LQ_ICU_IM2_IER) & (1 << 20); + im0_register = (*LTQ_ICU_IM0_IER) & (1 << 20); + im2_register = (*LTQ_ICU_IM2_IER) & (1 << 20); /* Turn off irq */ - #ifdef CONFIG_LANTIQ_AMAZON_SE + #ifdef CONFIG_SOC_AMAZON_SE disable_irq (IFXMIPS_USB_OC_INT0); disable_irq (IFXMIPS_USB_OC_INT2); #elif defined(CONFIG_LANTIQ_AR9) disable_irq (IFXMIPS_USB_OC_INT0); disable_irq (IFXMIPS_USB_OC_INT2); - #elif defined(CONFIG_SOC_LANTIQ_XWAY) - disable_irq (LQ_USB_OC_INT); + #elif defined(CONFIG_SOC_XWAY) + disable_irq (LTQ_USB_OC_INT); #else #error unkonwn arch #endif @@ -1353,14 +1367,14 @@ IFX_MEI_RunAdslModem (DSL_DEV_Device_t *pDev) MEI_WAIT_EVENT_TIMEOUT (DSL_DEV_PRIVATE(pDev)->wait_queue_modemready, 1000); - #ifdef CONFIG_LANTIQ_AMAZON_SE + #ifdef CONFIG_SOC_AMAZON_SE MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT0); MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT2); #elif defined(CONFIG_LANTIQ_AMAZON_S) MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT0); MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT2); - #elif defined(CONFIG_SOC_LANTIQ_XWAY) - MEI_MASK_AND_ACK_IRQ (LQ_USB_OC_INT); + #elif defined(CONFIG_SOC_XWAY) + MEI_MASK_AND_ACK_IRQ (LTQ_USB_OC_INT); #else #error unkonwn arch #endif @@ -1368,8 +1382,8 @@ IFX_MEI_RunAdslModem (DSL_DEV_Device_t *pDev) /* Re-enable irq */ enable_irq(pDev->nIrq[IFX_DYING_GASP]); - *LQ_ICU_IM0_IER |= im0_register; - *LQ_ICU_IM2_IER |= im2_register; + *LTQ_ICU_IM0_IER |= im0_register; + *LTQ_ICU_IM2_IER |= im2_register; if (DSL_DEV_PRIVATE(pDev)->modem_ready != 1) { IFX_MEI_EMSG ("Modem failed to be ready!\n"); @@ -1780,7 +1794,7 @@ static irqreturn_t IFX_MEI_IrqHandle (int int1, void *void0) { u32 scratch; DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) void0; -#if defined(CONFIG_LQ_MEI_FW_LOOPBACK) && defined(DFE_PING_TEST) +#if defined(CONFIG_LTQ_MEI_FW_LOOPBACK) && defined(DFE_PING_TEST) dfe_loopback_irq_handler (pDev); return IRQ_HANDLED; #endif //CONFIG_AMAZON_S_MEI_FW_LOOPBACK @@ -1889,7 +1903,7 @@ DSL_BSP_GetEventCB (int (**ifx_adsl_callback) } #endif -#ifdef CONFIG_LQ_MEI_FW_LOOPBACK +#ifdef CONFIG_LTQ_MEI_FW_LOOPBACK #define mte_reg_base (0x4800*4+0x20000) /* Iridia Registers Address Constants */ @@ -1949,20 +1963,20 @@ MEIWriteARCValue (u32 address, u32 value) u32 i, check = 0; /* Write address register */ - IFX_MEI_WRITE_REGISTER_L (address, ME_DBG_WR_AD + LQ_MEI_BASE_ADDR); + IFX_MEI_WRITE_REGISTER_L (address, ME_DBG_WR_AD + LTQ_MEI_BASE_ADDR); /* Write data register */ - IFX_MEI_WRITE_REGISTER_L (value, ME_DBG_DATA + LQ_MEI_BASE_ADDR); + IFX_MEI_WRITE_REGISTER_L (value, ME_DBG_DATA + LTQ_MEI_BASE_ADDR); /* wait until complete - timeout at 40 */ for (i = 0; i < 40; i++) { - check = IFX_MEI_READ_REGISTER_L (ME_ARC2ME_STAT + LQ_MEI_BASE_ADDR); + check = IFX_MEI_READ_REGISTER_L (ME_ARC2ME_STAT + LTQ_MEI_BASE_ADDR); if ((check & ARC_TO_MEI_DBG_DONE)) break; } /* clear the flag */ - IFX_MEI_WRITE_REGISTER_L (ARC_TO_MEI_DBG_DONE, ME_ARC2ME_STAT + LQ_MEI_BASE_ADDR); + IFX_MEI_WRITE_REGISTER_L (ARC_TO_MEI_DBG_DONE, ME_ARC2ME_STAT + LTQ_MEI_BASE_ADDR); } void @@ -2145,7 +2159,7 @@ DFE_Loopback_Test (void) IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); temp = 0; _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, - (u32) ME_XDATA_BASE_SH + LQ_MEI_BASE_ADDR, temp); + (u32) ME_XDATA_BASE_SH + LTQ_MEI_BASE_ADDR, temp); IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); i = IFX_MEI_DFEMemoryAlloc (pDev, SDRAM_SEGMENT_SIZE * 16); @@ -2155,9 +2169,9 @@ DFE_Loopback_Test (void) for (idx = 0; idx < i; idx++) { DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].type = FREE_RELOAD; IFX_MEI_WRITE_REGISTER_L ((((uint32_t) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].address) & 0x0fffffff), - LQ_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + idx * 4); + LTQ_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + idx * 4); IFX_MEI_DMSG("bar%d(%X)=%X\n", idx, - LQ_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + + LTQ_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + idx * 4, (((uint32_t) ((ifx_mei_device_private_t *) pDev->pPriv)->adsl_mem_info[idx]. @@ -2271,18 +2285,18 @@ IFX_MEI_InitDevice (int num) sizeof (smmu_mem_info_t) * MAX_BAR_REGISTERS); if (num == 0) { - pDev->nIrq[IFX_DFEIR] = LQ_MEI_INT; - pDev->nIrq[IFX_DYING_GASP] = LQ_MEI_DYING_GASP_INT; - pDev->base_address = LQ_MEI_BASE_ADDR; + pDev->nIrq[IFX_DFEIR] = LTQ_MEI_INT; + pDev->nIrq[IFX_DYING_GASP] = LTQ_MEI_DYING_GASP_INT; + pDev->base_address = KSEG1 + LTQ_MEI_BASE_ADDR; /* Power up MEI */ #ifdef CONFIG_LANTIQ_AMAZON_SE - *LQ_PMU_PWDCR &= ~(1 << 9); // enable dsl - *LQ_PMU_PWDCR &= ~(1 << 15); // enable AHB base + *LTQ_PMU_PWDCR &= ~(1 << 9); // enable dsl + *LTQ_PMU_PWDCR &= ~(1 << 15); // enable AHB base #else - temp = lq_r32(LQ_PMU_PWDCR); + temp = ltq_r32(LTQ_PMU_PWDCR); temp &= 0xffff7dbe; - lq_w32(temp, LQ_PMU_PWDCR); + ltq_w32(temp, LTQ_PMU_PWDCR); #endif } pDev->nInUse = 0; @@ -2443,7 +2457,7 @@ IFX_MEI_Ioctls (DSL_DEV_Device_t * pDev, int from_kernel, unsigned int command, { int i = 0; int meierr = DSL_DEV_MEI_ERR_SUCCESS; - u32 base_address = LQ_MEI_BASE_ADDR; + u32 base_address = LTQ_MEI_BASE_ADDR; DSL_DEV_WinHost_Message_t winhost_msg, m; DSL_DEV_MeiDebug_t debugrdwr; DSL_DEV_MeiReg_t regrdwr; @@ -2569,10 +2583,10 @@ IFX_MEI_Ioctls (DSL_DEV_Device_t * pDev, int from_kernel, unsigned int command, IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, (char *) (&bsp_mei_version), sizeof (DSL_DEV_Version_t)); break; -#define LQ_MPS_CHIPID_VERSION_GET(value) (((value) >> 28) & ((1 << 4) - 1)) +#define LTQ_MPS_CHIPID_VERSION_GET(value) (((value) >> 28) & ((1 << 4) - 1)) case DSL_FIO_BSP_GET_CHIP_INFO: bsp_chip_info.major = 1; - bsp_chip_info.minor = LQ_MPS_CHIPID_VERSION_GET(*LQ_MPS_CHIPID); + bsp_chip_info.minor = LTQ_MPS_CHIPID_VERSION_GET(*LTQ_MPS_CHIPID); IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, (char *) (&bsp_chip_info), sizeof (DSL_DEV_HwVersion_t)); meierr = DSL_DEV_MEI_ERR_SUCCESS; break; @@ -2608,7 +2622,7 @@ IFX_MEI_Ioctls (DSL_DEV_Device_t * pDev, int from_kernel, unsigned int command, void AMAZON_SE_MEI_ARC_MUX_Test(void) { u32 *p, i; - *LQ_RCU_RST |= LQ_RCU_RST_REQ_MUX_ARC; + *LTQ_RCU_RST |= LTQ_RCU_RST_REQ_MUX_ARC; p = (u32*)(DFE_LDST_BASE_ADDR + IRAM0_BASE); IFX_MEI_EMSG("Writing to IRAM0(%p)...\n", p); @@ -2657,7 +2671,7 @@ void AMAZON_SE_MEI_ARC_MUX_Test(void) if (*p != 0xdeadbeef) IFX_MEI_EMSG("%p: %#x\n", p, *p); } - *LQ_RCU_RST &= ~LQ_RCU_RST_REQ_MUX_ARC; + *LTQ_RCU_RST &= ~LTQ_RCU_RST_REQ_MUX_ARC; } #endif int @@ -2959,7 +2973,7 @@ IFX_MEI_ModuleInit (void) for (i = 0; i <= DSL_BSP_CB_LAST ; i++) dsl_bsp_event_callback[i].function = NULL; -#ifdef CONFIG_LQ_MEI_FW_LOOPBACK +#ifdef CONFIG_LTQ_MEI_FW_LOOPBACK IFX_MEI_DMSG("Start loopback test...\n"); DFE_Loopback_Test (); #endif diff --git a/package/ltq-ifxos/patches/120-linaro.patch b/package/ltq-ifxos/patches/120-linaro.patch index da5901465..0ad5a95cb 100644 --- a/package/ltq-ifxos/patches/120-linaro.patch +++ b/package/ltq-ifxos/patches/120-linaro.patch @@ -9,3 +9,15 @@ # error "missing endian definiton" #endif +--- a/src/linux/ifxos_linux_thread_drv.c ++++ b/src/linux/ifxos_linux_thread_drv.c +@@ -34,7 +34,9 @@ + #include <linux/sched.h> + #include <linux/version.h> + #include <linux/completion.h> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) + #include <linux/smp_lock.h> ++#endif + #include <linux/signal.h> + + diff --git a/package/ltq-tapi/patches/200-linux-37.patch b/package/ltq-tapi/patches/200-linux-37.patch index 0eac62ff9..9d7428df0 100644 --- a/package/ltq-tapi/patches/200-linux-37.patch +++ b/package/ltq-tapi/patches/200-linux-37.patch @@ -1,6 +1,26 @@ --- a/src/drv_tapi_linux.c +++ b/src/drv_tapi_linux.c -@@ -146,8 +146,13 @@ static ssize_t ifx_tapi_write(struct fil +@@ -47,7 +47,9 @@ + #include <linux/errno.h> + #include <asm/uaccess.h> /* copy_from_user(), ... */ + #include <asm/byteorder.h> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) + #include <linux/smp_lock.h> /* lock_kernel() */ ++#endif + #include <asm/io.h> + + #ifdef LINUX_2_6 +@@ -65,7 +67,9 @@ + #else + #include <linux/tqueue.h> + #include <linux/sched.h> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) + #include <linux/smp_lock.h> /* lock_kernel() */ ++#endif + #endif /* LINUX_2_6 */ + + #include "drv_tapi.h" +@@ -133,8 +137,13 @@ size_t count, loff_t * ppos); static ssize_t ifx_tapi_read(struct file * filp, char *buf, size_t length, loff_t * ppos); @@ -14,7 +34,7 @@ static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table); #ifdef CONFIG_PROC_FS -@@ -231,7 +236,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ +@@ -218,7 +227,11 @@ IFX_char_t *pRegDrvName = IFX_NULL; IFX_int32_t ret = 0; @@ -26,7 +46,7 @@ { #ifdef MODULE tapi_fops.owner = THIS_MODULE; -@@ -239,7 +248,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ +@@ -226,7 +239,11 @@ tapi_fops.read = ifx_tapi_read; tapi_fops.write = ifx_tapi_write; tapi_fops.poll = ifx_tapi_poll; @@ -38,7 +58,7 @@ tapi_fops.open = ifx_tapi_open; tapi_fops.release = ifx_tapi_release; } -@@ -894,8 +907,13 @@ static IFX_uint32_t ifx_tapi_poll (struc +@@ -881,8 +898,13 @@ - 0 and positive values - success - negative value - ioctl failed */ @@ -52,6 +72,29 @@ { TAPI_FD_PRIV_DATA_t *pTapiPriv; IFX_TAPI_ioctlCtx_t ctx; +@@ -3721,7 +3743,9 @@ + kernel lock (lock_kernel()). The lock must be + grabbed before changing the terminate + flag and released after the down() call. */ +- lock_kernel(); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) ++ lock_kernel(); ++#endif + mb(); + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) + kill_proc(pThrCntrl->tid, SIGKILL, 1); +@@ -3729,8 +3753,10 @@ + kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1); + #endif + /* release the big kernel lock */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) + unlock_kernel(); +- wait_for_completion (&pThrCntrl->thrCompletion); ++#endif ++ wait_for_completion (&pThrCntrl->thrCompletion); + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) + /* Now we are sure the thread is in zombie state. --- a/src/lib/lib_fifo/lib_fifo.c +++ b/src/lib/lib_fifo/lib_fifo.c @@ -41,7 +41,7 @@ diff --git a/package/ltq-vmmc/patches/100-ifxmips.patch b/package/ltq-vmmc/patches/100-ifxmips.patch index 95974ecba..a6d1c0039 100644 --- a/package/ltq-vmmc/patches/100-ifxmips.patch +++ b/package/ltq-vmmc/patches/100-ifxmips.patch @@ -33,7 +33,7 @@ #if defined SYSTEM_DANUBE -#include <asm/ifx/ifx_gpio.h> -+#include <xway/xway.h> ++#include <lantiq_soc.h> + #else #error no system selected @@ -158,7 +158,7 @@ +# define ifx_gptu_timer_free lq_free_timer + + -+# define bsp_mask_and_ack_irq lq_mask_and_ack_irq ++# define bsp_mask_and_ack_irq ltq_mask_and_ack_irq +#else +# include <asm/ifx/ifx_regs.h> +# include <asm/ifx/ifx_gptu.h> @@ -443,14 +443,14 @@ +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) +IFX_uint32_t ifx_get_cp1_size(IFX_void_t) +{ -+ return 2; ++ return 1; +} + -+unsigned int *lq_get_cp1_base(void); ++unsigned int *ltq_get_cp1_base(void); + +IFX_uint32_t *ifx_get_cp1_base(IFX_void_t) +{ -+ return lq_get_cp1_base(); ++ return ltq_get_cp1_base(); +} +#endif + @@ -501,7 +501,7 @@ +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) +# include <lantiq.h> +# include <irq.h> -+# include <xway/xway.h> ++# include <lantiq_soc.h> +# include <gpio.h> +#define IFXMIPS_MPS_SRAM ((u32 *)(KSEG1 + 0x1F200000)) +#define IFXMIPS_MPS_BASE_ADDR (KSEG1 + 0x1F107000) diff --git a/package/ltq-vmmc/patches/200-kernel-37.patch b/package/ltq-vmmc/patches/200-kernel-37.patch index d311d44a8..f5e2b36b7 100644 --- a/package/ltq-vmmc/patches/200-kernel-37.patch +++ b/package/ltq-vmmc/patches/200-kernel-37.patch @@ -1,6 +1,6 @@ --- a/src/drv_vmmc_init.c +++ b/src/drv_vmmc_init.c -@@ -784,7 +784,7 @@ IFX_int32_t VMMC_TAPI_LL_FW_Start(IFX_TA +@@ -784,7 +784,7 @@ dwld.fwDwld.length = IoInit.pram_size; /* download firmware */ @@ -9,7 +9,7 @@ (IFX_uint32_t) &dwld.fwDwld); } -@@ -1594,7 +1594,7 @@ IFX_void_t VMMC_DeviceDriverStop(IFX_voi +@@ -1594,7 +1594,7 @@ #ifdef VMMC_DRIVER_UNLOAD_HOOK if (VDevices[0].nDevState & DS_GPIO_RESERVED) { @@ -20,7 +20,7 @@ { --- a/src/mps/drv_mps_vmmc_linux.c +++ b/src/mps/drv_mps_vmmc_linux.c -@@ -110,7 +110,7 @@ IFX_int32_t ifx_mps_get_status_proc (IFX +@@ -110,7 +110,7 @@ #ifndef __KERNEL__ IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p); IFX_int32_t ifx_mps_close (struct inode *inode, struct file *file_p); @@ -29,7 +29,7 @@ IFX_uint32_t nCmd, IFX_ulong_t arg); IFX_int32_t ifx_mps_read_mailbox (mps_devices type, mps_message * rw); IFX_int32_t ifx_mps_write_mailbox (mps_devices type, mps_message * rw); -@@ -171,7 +171,7 @@ IFX_char_t voice_channel_int_name[NUM_VO +@@ -171,7 +171,7 @@ static struct file_operations ifx_mps_fops = { owner:THIS_MODULE, poll:ifx_mps_poll, @@ -38,7 +38,7 @@ open:ifx_mps_open, release:ifx_mps_close }; -@@ -614,7 +614,7 @@ static IFX_uint32_t ifx_mps_poll (struct +@@ -614,7 +614,7 @@ * \return -ENOIOCTLCMD Invalid command * \ingroup API */ @@ -47,7 +47,7 @@ IFX_uint32_t nCmd, IFX_ulong_t arg) { IFX_int32_t retvalue = -EINVAL; -@@ -629,17 +629,18 @@ IFX_int32_t ifx_mps_ioctl (struct inode +@@ -629,17 +629,18 @@ 'mps_devices' enum type, which in fact is [0..8]; So, if inode value is [0..NUM_VOICE_CHANNEL+1], then we make sure that we are calling from kernel space. */ @@ -71,7 +71,7 @@ { --- a/src/drv_vmmc_ioctl.c +++ b/src/drv_vmmc_ioctl.c -@@ -427,18 +427,18 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP +@@ -427,18 +427,18 @@ /* MPS driver will do the USR2KERN so just pass on the pointer. */ dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw; @@ -95,7 +95,7 @@ case FIO_LASTERR: --- a/src/mps/drv_mps_vmmc.h +++ b/src/mps/drv_mps_vmmc.h -@@ -279,7 +279,7 @@ typedef struct +@@ -279,7 +279,7 @@ #include <linux/fs.h> IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p); IFX_int32_t ifx_mps_close (struct inode *inode, struct file *filp); @@ -104,3 +104,89 @@ IFX_uint32_t nCmd, unsigned long arg); IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir, IFX_void_t (*callback) (mps_devices +--- a/src/drv_vmmc_linux.c ++++ b/src/drv_vmmc_linux.c +@@ -32,7 +32,11 @@ + #ifdef LINUX_2_6 + #include <linux/version.h> + #ifndef UTS_RELEASE ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) ++#include <linux/utsrelease.h> ++#else + #include <generated/utsrelease.h> ++#endif + #endif /* UTC_RELEASE */ + #undef CONFIG_DEVFS_FS + #endif /* LINUX_2_6 */ +--- a/src/mps/drv_mps_vmmc_common.c ++++ b/src/mps/drv_mps_vmmc_common.c +@@ -22,7 +22,11 @@ + #undef USE_PLAIN_VOICE_FIRMWARE + #undef PRINT_ON_ERR_INTERRUPT + #undef FAIL_ON_ERR_INTERRUPT +-#include <generated/autoconf.h> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) ++#include <linux/utsrelease.h> ++#else ++#include <generated/utsrelease.h> ++#endif + #include <linux/interrupt.h> + #include <linux/delay.h> + +@@ -47,8 +51,19 @@ + # define ifx_gptu_timer_free lq_free_timer + + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) + # define bsp_mask_and_ack_irq ltq_mask_and_ack_irq + #else ++extern void ltq_mask_and_ack_irq(struct irq_data *d); ++static void inline bsp_mask_and_ack_irq(int x) ++{ ++ struct irq_data d; ++ d.irq = x; ++ ltq_mask_and_ack_irq(&d); ++} ++#endif ++ ++#else + # include <asm/ifx/ifx_regs.h> + # include <asm/ifx/ifx_gptu.h> + #endif +@@ -107,7 +122,9 @@ + extern mps_mbx_dev *ifx_mps_get_device (mps_devices type); + + #ifdef LINUX_2_6 ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) + extern IFX_void_t bsp_mask_and_ack_irq (IFX_uint32_t irq_nr); ++#endif + + #else /* */ + extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr); +--- a/src/mps/drv_mps_vmmc_danube.c ++++ b/src/mps/drv_mps_vmmc_danube.c +@@ -16,11 +16,16 @@ + /* ============================= */ + /* Includes */ + /* ============================= */ ++#include "linux/version.h" + #include "drv_config.h" + + #ifdef SYSTEM_DANUBE /* defined in drv_mps_vmmc_config.h */ + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) ++#include <linux/autoconf.h> ++#else + #include <generated/autoconf.h> ++#endif + + /* lib_ifxos headers */ + #include "ifx_types.h" +@@ -39,6 +44,7 @@ + # include <linux/dma-mapping.h> + + ++#define LQ_RCU_BASE_ADDR (KSEG1 + LTQ_RCU_BASE_ADDR) + # define LQ_RCU_RST ((u32 *)(LQ_RCU_BASE_ADDR + 0x0010)) + #define IFX_RCU_RST_REQ_CPU1 (1 << 3) + # define IFX_RCU_RST_REQ LQ_RCU_RST |