aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm8668/patches-3.18
diff options
context:
space:
mode:
authorJames <>2015-11-04 11:49:21 +0000
committerJames <>2015-11-04 11:49:21 +0000
commit716ca530e1c4515d8683c9d5be3d56b301758b66 (patch)
tree700eb5bcc1a462a5f21dcec15ce7c97ecfefa772 /target/linux/adm8668/patches-3.18
downloadtrunk-47381-master.tar.gz
trunk-47381-master.tar.bz2
trunk-47381-master.zip
trunk-47381HEADmaster
Diffstat (limited to 'target/linux/adm8668/patches-3.18')
-rw-r--r--target/linux/adm8668/patches-3.18/001-adm8668_arch.patch48
-rw-r--r--target/linux/adm8668/patches-3.18/002-adm8668_pci.patch22
-rw-r--r--target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch22
-rw-r--r--target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch452
-rw-r--r--target/linux/adm8668/patches-3.18/005-tulip_platform.patch490
-rw-r--r--target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch377
-rw-r--r--target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch13
7 files changed, 1424 insertions, 0 deletions
diff --git a/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch b/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch
new file mode 100644
index 0000000..80e9ed1
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch
@@ -0,0 +1,48 @@
+--- a/arch/mips/Kbuild.platforms
++++ b/arch/mips/Kbuild.platforms
+@@ -30,6 +30,7 @@ platforms += sibyte
+ platforms += sni
+ platforms += txx9
+ platforms += vr41xx
++platforms += adm8668
+
+ # include the platform specific files
+ include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -136,6 +136,27 @@ config BCM47XX
+ help
+ Support for BCM47XX based boards
+
++config ADM8668
++ bool "WildPass ADM8668"
++ select SYS_HAS_CPU_MIPS32_R1
++ select BOOT_RAW
++ select NO_EXCEPT_FILL
++ select IRQ_CPU
++ select CEVT_R4K
++ select CSRC_R4K
++ select HW_HAS_PCI
++ select PCI
++ select SYS_SUPPORTS_LITTLE_ENDIAN
++ select SYS_SUPPORTS_32BIT_KERNEL
++ select DMA_NONCOHERENT
++ select SWAP_IO_SPACE
++ select SYS_HAS_EARLY_PRINTK
++ select ARCH_REQUIRE_GPIOLIB
++ select HAVE_CLK
++ help
++ ADM8668 board support by neutronscott
++ Scott Nicholas <neutronscott@scottn.us>
++
+ config BCM63XX
+ bool "Broadcom BCM63XX based boards"
+ select BOOT_RAW
+@@ -834,6 +855,7 @@ config MIPS_PARAVIRT
+
+ endchoice
+
++source "arch/mips/adm8668/Kconfig"
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+ source "arch/mips/bcm47xx/Kconfig"
diff --git a/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch b/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch
new file mode 100644
index 0000000..70ee00d
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch
@@ -0,0 +1,22 @@
+--- a/arch/mips/pci/Makefile
++++ b/arch/mips/pci/Makefile
+@@ -58,6 +58,7 @@ obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32
+ obj-$(CONFIG_CAVIUM_OCTEON_SOC) += pci-octeon.o pcie-octeon.o
+ obj-$(CONFIG_CPU_XLR) += pci-xlr.o
+ obj-$(CONFIG_CPU_XLP) += pci-xlp.o
++obj-$(CONFIG_ADM8668) += pci-adm8668.o
+
+ ifdef CONFIG_PCI_MSI
+ obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -1820,6 +1820,9 @@
+
+ #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */
+
++#define PCI_VENDOR_ADMTEK 0x1317
++#define PCI_DEVICE_ID_ADM8668 0x8688
++
+ #define PCI_VENDOR_ID_SIIG 0x131f
+ #define PCI_SUBVENDOR_ID_SIIG 0x131f
+ #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
diff --git a/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch b/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch
new file mode 100644
index 0000000..f7883cd
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch
@@ -0,0 +1,22 @@
+--- a/drivers/mtd/maps/Kconfig
++++ b/drivers/mtd/maps/Kconfig
+@@ -97,6 +97,12 @@ config MSP_FLASH_MAP_LIMIT
+ default "0x02000000"
+ depends on MSP_FLASH_MAP_LIMIT_32M
+
++config MTD_ADM8668_NOR
++ tristate "ADM8668 NOR mapping"
++ depends on ADM8668 && MTD_CFI
++ help
++ mapping driver for ADM8668 NOR
++
+ config MTD_SUN_UFLASH
+ tristate "Sun Microsystems userflash support"
+ depends on SPARC && MTD_CFI && PCI
+--- a/drivers/mtd/maps/Makefile
++++ b/drivers/mtd/maps/Makefile
+@@ -43,3 +43,4 @@ obj-$(CONFIG_MTD_VMU) += vmu-flash.o
+ obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
+ obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o
+ obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
++obj-$(CONFIG_MTD_ADM8668_NOR) += adm8668.o
diff --git a/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch b/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch
new file mode 100644
index 0000000..e57bdb7
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch
@@ -0,0 +1,452 @@
+--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
++++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
+@@ -207,6 +207,7 @@ struct tulip_chip_table tulip_tbl[] = {
+ };
+
+
++#ifdef CONFIG_TULIP_PCI
+ static const struct pci_device_id tulip_pci_tbl[] = {
+ { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
+ { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 },
+@@ -250,7 +251,7 @@ static const struct pci_device_id tulip_
+ { } /* terminate list */
+ };
+ MODULE_DEVICE_TABLE(pci, tulip_pci_tbl);
+-
++#endif
+
+ /* A full-duplex map for media types. */
+ const char tulip_media_cap[32] =
+@@ -268,11 +269,14 @@ static void tulip_down(struct net_device
+ static struct net_device_stats *tulip_get_stats(struct net_device *dev);
+ static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+ static void set_rx_mode(struct net_device *dev);
++#ifdef CONFIG_TULIP_PCI
+ static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts);
++#endif
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ static void poll_tulip(struct net_device *dev);
+ #endif
+
++#ifdef CONFIG_TULIP_PCI
+ static void tulip_set_power_state (struct tulip_private *tp,
+ int sleep, int snooze)
+ {
+@@ -289,7 +293,7 @@ static void tulip_set_power_state (struc
+ }
+
+ }
+-
++#endif
+
+ static void tulip_up(struct net_device *dev)
+ {
+@@ -303,6 +307,7 @@ static void tulip_up(struct net_device *
+ napi_enable(&tp->napi);
+ #endif
+
++#ifdef CONFIG_TULIP_PCI
+ /* Wake the chip from sleep/snooze mode. */
+ tulip_set_power_state (tp, 0, 0);
+
+@@ -310,6 +315,7 @@ static void tulip_up(struct net_device *
+ pci_enable_wake(tp->pdev, PCI_D3hot, 0);
+ pci_enable_wake(tp->pdev, PCI_D3cold, 0);
+ tulip_set_wolopts(tp->pdev, 0);
++#endif
+
+ /* On some chip revs we must set the MII/SYM port before the reset!? */
+ if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii))
+@@ -317,18 +323,22 @@ static void tulip_up(struct net_device *
+
+ /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */
+ iowrite32(0x00000001, ioaddr + CSR0);
++#ifdef CONFIG_TULIP_PCI
+ pci_read_config_dword(tp->pdev, PCI_COMMAND, &reg); /* flush write */
++#endif
+ udelay(100);
+
+ /* Deassert reset.
+ Wait the specified 50 PCI cycles after a reset by initializing
+ Tx and Rx queues and the address filter list. */
+ iowrite32(tp->csr0, ioaddr + CSR0);
++#ifdef CONFIG_TULIP_PCI
+ pci_read_config_dword(tp->pdev, PCI_COMMAND, &reg); /* flush write */
++#endif
+ udelay(100);
+
+ if (tulip_debug > 1)
+- netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->pdev->irq);
++ netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->irq);
+
+ iowrite32(tp->rx_ring_dma, ioaddr + CSR3);
+ iowrite32(tp->tx_ring_dma, ioaddr + CSR4);
+@@ -362,9 +372,11 @@ static void tulip_up(struct net_device *
+ *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
+ *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
+
++#ifdef CONFIG_TULIP_PCI
+ mapping = pci_map_single(tp->pdev, tp->setup_frame,
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
++#endif
+ tp->tx_buffers[tp->cur_tx].skb = NULL;
+ tp->tx_buffers[tp->cur_tx].mapping = mapping;
+
+@@ -520,7 +532,7 @@ tulip_open(struct net_device *dev)
+
+ tulip_init_ring (dev);
+
+- retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED,
++ retval = request_irq(tp->irq, tulip_interrupt, IRQF_SHARED,
+ dev->name, dev);
+ if (retval)
+ goto free_ring;
+@@ -644,8 +656,10 @@ static void tulip_init_ring(struct net_d
+ tp->rx_buffers[i].skb = skb;
+ if (skb == NULL)
+ break;
++#ifdef CONFIG_TULIP_PCI
+ mapping = pci_map_single(tp->pdev, skb->data,
+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
++#endif
+ tp->rx_buffers[i].mapping = mapping;
+ tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */
+ tp->rx_ring[i].buffer1 = cpu_to_le32(mapping);
+@@ -678,8 +692,10 @@ tulip_start_xmit(struct sk_buff *skb, st
+ entry = tp->cur_tx % TX_RING_SIZE;
+
+ tp->tx_buffers[entry].skb = skb;
++#ifdef CONFIG_TULIP_PCI
+ mapping = pci_map_single(tp->pdev, skb->data,
+ skb->len, PCI_DMA_TODEVICE);
++#endif
+ tp->tx_buffers[entry].mapping = mapping;
+ tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
+
+@@ -730,16 +746,19 @@ static void tulip_clean_tx_ring(struct t
+ if (tp->tx_buffers[entry].skb == NULL) {
+ /* test because dummy frames not mapped */
+ if (tp->tx_buffers[entry].mapping)
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev,
+ tp->tx_buffers[entry].mapping,
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
++#endif
+ continue;
+ }
+-
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping,
+ tp->tx_buffers[entry].skb->len,
+ PCI_DMA_TODEVICE);
++#endif
+
+ /* Free the original skb. */
+ dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
+@@ -790,7 +809,9 @@ static void tulip_down (struct net_devic
+ dev->if_port = tp->saved_if_port;
+
+ /* Leave the driver in snooze, not sleep, mode. */
++#ifdef CONFIG_TULIP_PCI
+ tulip_set_power_state (tp, 0, 1);
++#endif
+ }
+
+ static void tulip_free_ring (struct net_device *dev)
+@@ -811,8 +832,10 @@ static void tulip_free_ring (struct net_
+ /* An invalid address. */
+ tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
+ if (skb) {
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
+ PCI_DMA_FROMDEVICE);
++#endif
+ dev_kfree_skb (skb);
+ }
+ }
+@@ -821,8 +844,10 @@ static void tulip_free_ring (struct net_
+ struct sk_buff *skb = tp->tx_buffers[i].skb;
+
+ if (skb != NULL) {
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping,
+ skb->len, PCI_DMA_TODEVICE);
++#endif
+ dev_kfree_skb (skb);
+ }
+ tp->tx_buffers[i].skb = NULL;
+@@ -843,7 +868,7 @@ static int tulip_close (struct net_devic
+ netdev_dbg(dev, "Shutting down ethercard, status was %02x\n",
+ ioread32 (ioaddr + CSR5));
+
+- free_irq (tp->pdev->irq, dev);
++ free_irq (tp->irq, dev);
+
+ tulip_free_ring (dev);
+
+@@ -874,7 +899,9 @@ static void tulip_get_drvinfo(struct net
+ struct tulip_private *np = netdev_priv(dev);
+ strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+ strlcpy(info->version, DRV_VERSION, sizeof(info->version));
++#ifdef CONFIG_TULIP_PCI
+ strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
++#endif
+ }
+
+
+@@ -887,7 +914,9 @@ static int tulip_ethtool_set_wol(struct
+ return -EOPNOTSUPP;
+
+ tp->wolinfo.wolopts = wolinfo->wolopts;
+- device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts);
++#ifdef CONFIG_TULIP_PCI
++ device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts);
++#endif
+ return 0;
+ }
+
+@@ -1165,9 +1194,11 @@ static void set_rx_mode(struct net_devic
+
+ tp->tx_buffers[entry].skb = NULL;
+ tp->tx_buffers[entry].mapping =
++#ifdef CONFIG_TULIP_PCI
+ pci_map_single(tp->pdev, tp->setup_frame,
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
++#endif
+ /* Put the setup frame on the Tx list. */
+ if (entry == TX_RING_SIZE-1)
+ tx_flags |= DESC_RING_WRAP; /* Wrap ring. */
+@@ -1264,19 +1295,22 @@ out:
+ netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n",
+ cache, csr0);
+ }
+-#endif
+
+ /*
+ * Chips that have the MRM/reserved bit quirk and the burst quirk. That
+ * is the DM910X and the on chip ULi devices
+ */
++#endif
+
++#ifdef CONFIG_TULIP_PCI
+ static int tulip_uli_dm_quirk(struct pci_dev *pdev)
+ {
+ if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
+ return 1;
+ return 0;
+ }
++#endif
++
+
+ static const struct net_device_ops tulip_netdev_ops = {
+ .ndo_open = tulip_open,
+@@ -1294,6 +1328,7 @@ static const struct net_device_ops tulip
+ #endif
+ };
+
++#ifdef CONFIG_TULIP_PCI
+ const struct pci_device_id early_486_chipsets[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) },
+ { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) },
+@@ -1471,6 +1506,8 @@ static int tulip_init_one(struct pci_dev
+ }
+ }
+ tp->pdev = pdev;
++ tp->kdev = &pdev->dev;
++ tp->irq = irq;
+ tp->base_addr = ioaddr;
+ tp->revision = pdev->revision;
+ tp->csr0 = csr0;
+@@ -1801,6 +1838,7 @@ err_out_free_netdev:
+ }
+
+
++#ifdef CONFIG_TULIP_PCI
+ /* set the registers according to the given wolopts */
+ static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts)
+ {
+@@ -1829,6 +1867,7 @@ static void tulip_set_wolopts (struct pc
+ iowrite32(tmp, ioaddr + CSR13);
+ }
+ }
++#endif
+
+ #ifdef CONFIG_PM
+
+@@ -1943,6 +1982,7 @@ static void tulip_remove_one(struct pci_
+
+ /* pci_power_off (pdev, -1); */
+ }
++#endif /* CONFIG_TULIP_PCI */
+
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ /*
+@@ -1964,7 +2004,8 @@ static void poll_tulip (struct net_devic
+ }
+ #endif
+
+-static struct pci_driver tulip_driver = {
++#ifdef CONFIG_TULIP_PCI
++static struct pci_driver tulip_pci_driver = {
+ .name = DRV_NAME,
+ .id_table = tulip_pci_tbl,
+ .probe = tulip_init_one,
+@@ -1974,10 +2015,12 @@ static struct pci_driver tulip_driver =
+ .resume = tulip_resume,
+ #endif /* CONFIG_PM */
+ };
++#endif
+
+
+ static int __init tulip_init (void)
+ {
++ int ret = 0;
+ #ifdef MODULE
+ pr_info("%s", version);
+ #endif
+@@ -1987,13 +2030,18 @@ static int __init tulip_init (void)
+ tulip_max_interrupt_work = max_interrupt_work;
+
+ /* probe for and init boards */
+- return pci_register_driver(&tulip_driver);
++#ifdef CONFIG_TULIP_PCI
++ ret = pci_register_driver(&tulip_pci_driver);
++#endif
++ return ret;
+ }
+
+
+ static void __exit tulip_cleanup (void)
+ {
+- pci_unregister_driver (&tulip_driver);
++#ifdef CONFIG_TULIP_PCI
++ pci_unregister_driver (&tulip_pci_driver);
++#endif
+ }
+
+
+--- a/drivers/net/ethernet/dec/tulip/interrupt.c
++++ b/drivers/net/ethernet/dec/tulip/interrupt.c
+@@ -73,10 +73,11 @@ int tulip_refill_rx(struct net_device *d
+ netdev_alloc_skb(dev, PKT_BUF_SZ);
+ if (skb == NULL)
+ break;
+-
++#ifdef CONFIG_TULIP_PCI
+ mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
+ PCI_DMA_FROMDEVICE);
+- if (dma_mapping_error(&tp->pdev->dev, mapping)) {
++#endif
++ if (dma_mapping_error(tp->kdev, mapping)) {
+ dev_kfree_skb(skb);
+ tp->rx_buffers[entry].skb = NULL;
+ break;
+@@ -210,9 +211,11 @@ int tulip_poll(struct napi_struct *napi,
+ if (pkt_len < tulip_rx_copybreak &&
+ (skb = netdev_alloc_skb(dev, pkt_len + 2)) != NULL) {
+ skb_reserve(skb, 2); /* 16 byte align the IP header */
++#ifdef CONFIG_TULIP_PCI
+ pci_dma_sync_single_for_cpu(tp->pdev,
+ tp->rx_buffers[entry].mapping,
+ pkt_len, PCI_DMA_FROMDEVICE);
++#endif
+ #if ! defined(__alpha__)
+ skb_copy_to_linear_data(skb, tp->rx_buffers[entry].skb->data,
+ pkt_len);
+@@ -222,9 +225,11 @@ int tulip_poll(struct napi_struct *napi,
+ tp->rx_buffers[entry].skb->data,
+ pkt_len);
+ #endif
++#ifdef CONFIG_TULIP_PCI
+ pci_dma_sync_single_for_device(tp->pdev,
+ tp->rx_buffers[entry].mapping,
+ pkt_len, PCI_DMA_FROMDEVICE);
++#endif
+ } else { /* Pass up the skb already on the Rx ring. */
+ char *temp = skb_put(skb = tp->rx_buffers[entry].skb,
+ pkt_len);
+@@ -239,9 +244,10 @@ int tulip_poll(struct napi_struct *napi,
+ skb->head, temp);
+ }
+ #endif
+-
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping,
+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
++#endif
+
+ tp->rx_buffers[entry].skb = NULL;
+ tp->rx_buffers[entry].mapping = 0;
+@@ -597,10 +603,12 @@ irqreturn_t tulip_interrupt(int irq, voi
+ if (tp->tx_buffers[entry].skb == NULL) {
+ /* test because dummy frames not mapped */
+ if (tp->tx_buffers[entry].mapping)
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev,
+ tp->tx_buffers[entry].mapping,
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
++#endif
+ continue;
+ }
+
+@@ -628,10 +636,11 @@ irqreturn_t tulip_interrupt(int irq, voi
+ dev->stats.collisions += (status >> 3) & 15;
+ dev->stats.tx_packets++;
+ }
+-
++#ifdef CONFIG_TULIP_PCI
+ pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping,
+ tp->tx_buffers[entry].skb->len,
+ PCI_DMA_TODEVICE);
++#endif
+
+ /* Free the original skb. */
+ dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
+--- a/drivers/net/ethernet/dec/tulip/Kconfig
++++ b/drivers/net/ethernet/dec/tulip/Kconfig
+@@ -40,8 +40,12 @@ config DE2104X_DSL
+ Default is 0, and range is 0 to 31.
+
+ config TULIP
++ tristate
++
++config TULIP_PCI
+ tristate "DECchip Tulip (dc2114x) PCI support"
+ depends on PCI
++ select TULIP
+ select CRC32
+ ---help---
+ This driver is developed for the SMC EtherPower series Ethernet
+@@ -58,7 +62,7 @@ config TULIP
+
+ config TULIP_MWI
+ bool "New bus configuration"
+- depends on TULIP
++ depends on TULIP_PCI
+ ---help---
+ This configures your Tulip card specifically for the card and
+ system cache line size type you are using.
+@@ -69,7 +73,7 @@ config TULIP_MWI
+
+ config TULIP_MMIO
+ bool "Use PCI shared mem for NIC registers"
+- depends on TULIP
++ depends on TULIP_PCI
+ ---help---
+ Use PCI shared memory for the NIC registers, rather than going through
+ the Tulip's PIO (programmed I/O ports). Faster, but could produce
+--- a/drivers/net/ethernet/dec/tulip/tulip.h
++++ b/drivers/net/ethernet/dec/tulip/tulip.h
+@@ -447,6 +447,8 @@ struct tulip_private {
+ int cur_index; /* Current media index. */
+ int saved_if_port;
+ struct pci_dev *pdev;
++ struct device *kdev;
++ int irq;
+ int ttimer;
+ int susp_rx;
+ unsigned long nir;
diff --git a/target/linux/adm8668/patches-3.18/005-tulip_platform.patch b/target/linux/adm8668/patches-3.18/005-tulip_platform.patch
new file mode 100644
index 0000000..bddc572
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/005-tulip_platform.patch
@@ -0,0 +1,490 @@
+--- a/drivers/net/ethernet/dec/tulip/Kconfig
++++ b/drivers/net/ethernet/dec/tulip/Kconfig
+@@ -60,6 +60,14 @@ config TULIP_PCI
+ To compile this driver as a module, choose M here. The module will
+ be called tulip.
+
++config TULIP_PLATFORM
++ tristate "DECchip Tulip (dc2114x) Platform support"
++ depends on HAS_IOMEM
++ select TULIP
++ select CRC32
++ ---help---
++ This driver is for the platform variant.
++
+ config TULIP_MWI
+ bool "New bus configuration"
+ depends on TULIP_PCI
+--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
++++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
+@@ -27,6 +27,8 @@
+ #include <linux/init.h>
+ #include <linux/interrupt.h>
+ #include <linux/etherdevice.h>
++#include <linux/platform_device.h>
++#include <linux/platform_data/tulip.h>
+ #include <linux/delay.h>
+ #include <linux/mii.h>
+ #include <linux/crc32.h>
+@@ -204,6 +206,9 @@ struct tulip_chip_table tulip_tbl[] = {
+ { "Conexant LANfinity", 256, 0x0001ebef,
+ HAS_MII | HAS_ACPI, tulip_timer, tulip_media_task },
+
++ { "Infineon ADM8668", 256, 0x0001a451,
++ MC_HASH_ONLY | COMET_MAC_ADDR, tulip_timer, tulip_media_task, },
++
+ };
+
+
+@@ -377,6 +382,11 @@ static void tulip_up(struct net_device *
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ mapping = dma_map_single(&tp->pldev->dev, tp->setup_frame,
++ sizeof(tp->setup_frame),
++ DMA_TO_DEVICE);
++#endif
+ tp->tx_buffers[tp->cur_tx].skb = NULL;
+ tp->tx_buffers[tp->cur_tx].mapping = mapping;
+
+@@ -396,6 +406,7 @@ static void tulip_up(struct net_device *
+ i = 0;
+ if (tp->mtable == NULL)
+ goto media_picked;
++
+ if (dev->if_port) {
+ int looking_for = tulip_media_cap[dev->if_port] & MediaIsMII ? 11 :
+ (dev->if_port == 12 ? 0 : dev->if_port);
+@@ -489,6 +500,10 @@ media_picked:
+ iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88);
+ dev->if_port = tp->mii_cnt ? 11 : 0;
+ tp->csr6 = 0x00040000;
++ } else if (tp->chip_id == ADM8668) {
++ /* Enable automatic Tx underrun recovery. */
++ iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88);
++ tp->csr6 = 0x00040000;
+ } else if (tp->chip_id == AX88140) {
+ tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100;
+ } else
+@@ -660,6 +675,10 @@ static void tulip_init_ring(struct net_d
+ mapping = pci_map_single(tp->pdev, skb->data,
+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ mapping = dma_map_single(&tp->pldev->dev, skb->data,
++ PKT_BUF_SZ, DMA_FROM_DEVICE);
++#endif
+ tp->rx_buffers[i].mapping = mapping;
+ tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */
+ tp->rx_ring[i].buffer1 = cpu_to_le32(mapping);
+@@ -696,6 +715,11 @@ tulip_start_xmit(struct sk_buff *skb, st
+ mapping = pci_map_single(tp->pdev, skb->data,
+ skb->len, PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ mapping = dma_map_single(&tp->pldev->dev, skb->data,
++ skb->len,
++ DMA_TO_DEVICE);
++#endif
+ tp->tx_buffers[entry].mapping = mapping;
+ tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
+
+@@ -752,6 +776,13 @@ static void tulip_clean_tx_ring(struct t
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev,
++ tp->tx_buffers[entry].mapping,
++ sizeof(tp->setup_frame),
++ DMA_TO_DEVICE);
++#endif
++
+ continue;
+ }
+ #ifdef CONFIG_TULIP_PCI
+@@ -759,6 +790,11 @@ static void tulip_clean_tx_ring(struct t
+ tp->tx_buffers[entry].skb->len,
+ PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping,
++ tp->tx_buffers[entry].skb->len,
++ DMA_TO_DEVICE);
++#endif
+
+ /* Free the original skb. */
+ dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
+@@ -836,6 +872,10 @@ static void tulip_free_ring (struct net_
+ pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
+ PCI_DMA_FROMDEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev, mapping, PKT_BUF_SZ,
++ DMA_FROM_DEVICE);
++#endif
+ dev_kfree_skb (skb);
+ }
+ }
+@@ -848,6 +888,10 @@ static void tulip_free_ring (struct net_
+ pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping,
+ skb->len, PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[i].mapping,
++ skb->len, DMA_TO_DEVICE);
++#endif
+ dev_kfree_skb (skb);
+ }
+ tp->tx_buffers[i].skb = NULL;
+@@ -902,6 +946,9 @@ static void tulip_get_drvinfo(struct net
+ #ifdef CONFIG_TULIP_PCI
+ strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ strlcpy(info->bus_info, "platform", sizeof(info->bus_info));
++#endif
+ }
+
+
+@@ -917,6 +964,9 @@ static int tulip_ethtool_set_wol(struct
+ #ifdef CONFIG_TULIP_PCI
+ device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ device_set_wakeup_enable(&tp->pldev->dev, tp->wolinfo.wolopts);
++#endif
+ return 0;
+ }
+
+@@ -1192,13 +1242,20 @@ static void set_rx_mode(struct net_devic
+
+ }
+
++#ifdef CONFIG_TULIP_PCI
+ tp->tx_buffers[entry].skb = NULL;
+ tp->tx_buffers[entry].mapping =
+-#ifdef CONFIG_TULIP_PCI
+ pci_map_single(tp->pdev, tp->setup_frame,
+ sizeof(tp->setup_frame),
+ PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ tp->tx_buffers[entry].skb = NULL;
++ tp->tx_buffers[entry].mapping =
++ dma_map_single(&tp->pldev->dev, tp->setup_frame,
++ sizeof(tp->setup_frame),
++ DMA_TO_DEVICE);
++#endif
+ /* Put the setup frame on the Tx list. */
+ if (entry == TX_RING_SIZE-1)
+ tx_flags |= DESC_RING_WRAP; /* Wrap ring. */
+@@ -1218,6 +1275,9 @@ static void set_rx_mode(struct net_devic
+ spin_unlock_irqrestore(&tp->lock, flags);
+ }
+
++ if (tp->chip_id == ADM8668)
++ csr6 |= (1 << 9); /* force 100Mbps full duplex */
++
+ iowrite32(csr6, ioaddr + CSR6);
+ }
+
+@@ -1984,6 +2044,126 @@ static void tulip_remove_one(struct pci_
+ }
+ #endif /* CONFIG_TULIP_PCI */
+
++#ifdef CONFIG_TULIP_PLATFORM
++static int tulip_probe(struct platform_device *pdev)
++{
++ struct tulip_private *tp;
++ struct tulip_platform_data *pdata;
++ struct net_device *dev;
++ struct resource *res;
++ void __iomem *ioaddr;
++ int irq;
++
++ if (pdev->id < 0 || pdev->id >= MAX_UNITS)
++ return -EINVAL;
++
++ if (!(res = platform_get_resource(pdev, IORESOURCE_IRQ, 0)))
++ return -ENODEV;
++ irq = res->start;
++ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0)))
++ return -ENODEV;
++ if (!(ioaddr = ioremap(res->start, res->end - res->start)))
++ return -ENODEV;
++
++ pdata = pdev->dev.platform_data;
++ if (!pdata)
++ return -ENODEV;
++
++ if (!(dev = alloc_etherdev(sizeof (*tp))))
++ return -ENOMEM;
++
++ /* setup net dev */
++ dev->base_addr = (unsigned long)res->start;
++ dev->irq = irq;
++ SET_NETDEV_DEV(dev, &pdev->dev);
++
++ /* tulip private struct */
++ tp = netdev_priv(dev);
++ tp->dev = dev;
++ tp->base_addr = ioaddr;
++ tp->csr0 = 0;
++ tp->pldev = pdev;
++ tp->kdev = &pdev->dev;
++ tp->irq = irq;
++ tp->rx_ring = dma_alloc_coherent(&pdev->dev,
++ sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
++ sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
++ &tp->rx_ring_dma, GFP_KERNEL);
++ if (!tp->rx_ring)
++ return -ENODEV;
++ tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE);
++ tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE;
++
++ tp->chip_id = pdata->chip_id;
++ tp->flags = tulip_tbl[tp->chip_id].flags;
++
++ spin_lock_init(&tp->lock);
++ spin_lock_init(&tp->mii_lock);
++
++ init_timer(&tp->timer);
++ tp->timer.data = (unsigned long)dev;
++ tp->timer.function = tulip_tbl[tp->chip_id].media_timer;
++
++ INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task);
++
++ /* Stop the chip's Tx and Rx processes. */
++ tulip_stop_rxtx(tp);
++
++ /* Clear the missed-packet counter. */
++ ioread32(ioaddr + CSR8);
++
++ if (!is_valid_ether_addr(pdata->mac)) {
++ dev_info(&pdev->dev, "generating random ethernet MAC\n");
++ random_ether_addr(dev->dev_addr);
++ } else
++ memcpy(dev->dev_addr, pdata->mac, ETH_ALEN);
++
++ /* The Tulip-specific entries in the device structure. */
++ dev->netdev_ops = &tulip_netdev_ops;
++ dev->watchdog_timeo = TX_TIMEOUT;
++ netif_napi_add(dev, &tp->napi, tulip_poll, 16);
++ dev->ethtool_ops = &ops;
++
++ if (register_netdev(dev))
++ goto err_out_free_ring;
++
++ dev_info(&dev->dev,
++ "tulip_platform (%s) at MMIO %#lx %pM, IRQ %d\n",
++ tulip_tbl[tp->chip_id].chip_name,
++ (unsigned long)dev->base_addr, dev->dev_addr, irq);
++
++ platform_set_drvdata(pdev, dev);
++ return 0;
++
++err_out_free_ring:
++ dma_free_coherent(&pdev->dev,
++ sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
++ sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
++ tp->rx_ring, tp->rx_ring_dma);
++ return -ENODEV;
++}
++
++static int tulip_remove(struct platform_device *pdev)
++{
++ struct net_device *dev = platform_get_drvdata (pdev);
++ struct tulip_private *tp;
++
++ if (!dev)
++ return -ENODEV;
++
++ tp = netdev_priv(dev);
++ unregister_netdev(dev);
++ dma_free_coherent(&pdev->dev,
++ sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
++ sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
++ tp->rx_ring, tp->rx_ring_dma);
++ iounmap(tp->base_addr);
++ free_netdev(dev);
++ platform_set_drvdata(pdev, NULL);
++ return 0;
++}
++#endif
++
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ /*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+@@ -2017,6 +2197,17 @@ static struct pci_driver tulip_pci_drive
+ };
+ #endif
+
++#ifdef CONFIG_TULIP_PLATFORM
++static struct platform_driver tulip_platform_driver = {
++ .probe = tulip_probe,
++ .remove = tulip_remove,
++ .driver = {
++ .owner = THIS_MODULE,
++ .name = DRV_NAME,
++ },
++};
++#endif
++
+
+ static int __init tulip_init (void)
+ {
+@@ -2033,6 +2224,9 @@ static int __init tulip_init (void)
+ #ifdef CONFIG_TULIP_PCI
+ ret = pci_register_driver(&tulip_pci_driver);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ ret = platform_driver_register(&tulip_platform_driver);
++#endif
+ return ret;
+ }
+
+@@ -2042,6 +2236,9 @@ static void __exit tulip_cleanup (void)
+ #ifdef CONFIG_TULIP_PCI
+ pci_unregister_driver (&tulip_pci_driver);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ platform_driver_unregister (&tulip_platform_driver);
++#endif
+ }
+
+
+--- a/drivers/net/ethernet/dec/tulip/tulip.h
++++ b/drivers/net/ethernet/dec/tulip/tulip.h
+@@ -21,6 +21,8 @@
+ #include <linux/timer.h>
+ #include <linux/delay.h>
+ #include <linux/pci.h>
++#include <linux/platform_device.h>
++#include <linux/platform_data/tulip.h>
+ #include <asm/io.h>
+ #include <asm/irq.h>
+ #include <asm/unaligned.h>
+@@ -69,28 +71,6 @@ enum tbl_flag {
+ };
+
+
+-/* chip types. careful! order is VERY IMPORTANT here, as these
+- * are used throughout the driver as indices into arrays */
+-/* Note 21142 == 21143. */
+-enum chips {
+- DC21040 = 0,
+- DC21041 = 1,
+- DC21140 = 2,
+- DC21142 = 3, DC21143 = 3,
+- LC82C168,
+- MX98713,
+- MX98715,
+- MX98725,
+- AX88140,
+- PNIC2,
+- COMET,
+- COMPEX9881,
+- I21145,
+- DM910X,
+- CONEXANT,
+-};
+-
+-
+ enum MediaIs {
+ MediaIsFD = 1,
+ MediaAlwaysFD = 2,
+@@ -446,7 +426,12 @@ struct tulip_private {
+ struct mediatable *mtable;
+ int cur_index; /* Current media index. */
+ int saved_if_port;
++#ifdef CONFIG_TULIP_PCI
+ struct pci_dev *pdev;
++#endif
++#ifdef CONFIG_TULIP_PLATFORM
++ struct platform_device *pldev;
++#endif
+ struct device *kdev;
+ int irq;
+ int ttimer;
+--- a/drivers/net/ethernet/dec/tulip/interrupt.c
++++ b/drivers/net/ethernet/dec/tulip/interrupt.c
+@@ -77,6 +77,10 @@ int tulip_refill_rx(struct net_device *d
+ mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
+ PCI_DMA_FROMDEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ mapping = dma_map_single(&tp->pldev->dev, skb->data, PKT_BUF_SZ,
++ DMA_FROM_DEVICE);
++#endif
+ if (dma_mapping_error(tp->kdev, mapping)) {
+ dev_kfree_skb(skb);
+ tp->rx_buffers[entry].skb = NULL;
+@@ -204,8 +208,7 @@ int tulip_poll(struct napi_struct *napi,
+ dev->stats.rx_fifo_errors++;
+ }
+ } else {
+- struct sk_buff *skb;
+-
++ struct sk_buff *skb;
+ /* Check if the packet is long enough to accept without copying
+ to a minimally-sized skbuff. */
+ if (pkt_len < tulip_rx_copybreak &&
+@@ -248,6 +251,10 @@ int tulip_poll(struct napi_struct *napi,
+ pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping,
+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev, tp->rx_buffers[entry].mapping,
++ PKT_BUF_SZ, DMA_FROM_DEVICE);
++#endif
+
+ tp->rx_buffers[entry].skb = NULL;
+ tp->rx_buffers[entry].mapping = 0;
+@@ -641,6 +648,11 @@ irqreturn_t tulip_interrupt(int irq, voi
+ tp->tx_buffers[entry].skb->len,
+ PCI_DMA_TODEVICE);
+ #endif
++#ifdef CONFIG_TULIP_PLATFORM
++ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping,
++ tp->tx_buffers[entry].skb->len,
++ DMA_TO_DEVICE);
++#endif
+
+ /* Free the original skb. */
+ dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
+--- /dev/null
++++ b/include/linux/platform_data/tulip.h
+@@ -0,0 +1,31 @@
++#ifndef _LINUX_TULIP_PDATA_H
++#define _LINUX_TULIP_PDATA_H
++
++/* chip types. careful! order is VERY IMPORTANT here, as these
++ * are used throughout the driver as indices into arrays */
++/* Note 21142 == 21143. */
++enum chips {
++ DC21040 = 0,
++ DC21041 = 1,
++ DC21140 = 2,
++ DC21142 = 3, DC21143 = 3,
++ LC82C168,
++ MX98713,
++ MX98715,
++ MX98725,
++ AX88140,
++ PNIC2,
++ COMET,
++ COMPEX9881,
++ I21145,
++ DM910X,
++ CONEXANT,
++ ADM8668,
++};
++
++struct tulip_platform_data {
++ u8 mac[6];
++ enum chips chip_id;
++};
++
++#endif
diff --git a/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch
new file mode 100644
index 0000000..66f4f25
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch
@@ -0,0 +1,377 @@
+--- a/drivers/tty/serial/amba-pl010.c
++++ b/drivers/tty/serial/amba-pl010.c
+@@ -48,11 +48,10 @@
+ #include <linux/slab.h>
+ #include <linux/io.h>
+
+-#define UART_NR 8
+-
+ #define SERIAL_AMBA_MAJOR 204
+ #define SERIAL_AMBA_MINOR 16
+-#define SERIAL_AMBA_NR UART_NR
++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
++#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
+
+ #define AMBA_ISR_PASS_LIMIT 256
+
+@@ -78,9 +77,9 @@ static void pl010_stop_tx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_start_tx(struct uart_port *port)
+@@ -88,9 +87,9 @@ static void pl010_start_tx(struct uart_p
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_stop_rx(struct uart_port *port)
+@@ -98,9 +97,9 @@ static void pl010_stop_rx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_enable_ms(struct uart_port *port)
+@@ -108,18 +107,18 @@ static void pl010_enable_ms(struct uart_
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_MSIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_rx_chars(struct uart_amba_port *uap)
+ {
+ unsigned int status, ch, flag, rsr, max_count = 256;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ while (UART_RX_DATA(status) && max_count--) {
+- ch = readb(uap->port.membase + UART01x_DR);
++ ch = __raw_readl(uap->port.membase + UART01x_DR);
+ flag = TTY_NORMAL;
+
+ uap->port.icount.rx++;
+@@ -128,9 +127,9 @@ static void pl010_rx_chars(struct uart_a
+ * Note that the error handling code is
+ * out of the main execution path
+ */
+- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
+ if (unlikely(rsr & UART01x_RSR_ANY)) {
+- writel(0, uap->port.membase + UART01x_ECR);
++ __raw_writel(0, uap->port.membase + UART01x_ECR);
+
+ if (rsr & UART01x_RSR_BE) {
+ rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
+@@ -160,7 +159,7 @@ static void pl010_rx_chars(struct uart_a
+ uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
+
+ ignore_char:
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ }
+ spin_unlock(&uap->port.lock);
+ tty_flip_buffer_push(&uap->port.state->port);
+@@ -173,7 +172,7 @@ static void pl010_tx_chars(struct uart_a
+ int count;
+
+ if (uap->port.x_char) {
+- writel(uap->port.x_char, uap->port.membase + UART01x_DR);
++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR);
+ uap->port.icount.tx++;
+ uap->port.x_char = 0;
+ return;
+@@ -185,7 +184,7 @@ static void pl010_tx_chars(struct uart_a
+
+ count = uap->port.fifosize >> 1;
+ do {
+- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ uap->port.icount.tx++;
+ if (uart_circ_empty(xmit))
+@@ -203,9 +202,9 @@ static void pl010_modem_status(struct ua
+ {
+ unsigned int status, delta;
+
+- writel(0, uap->port.membase + UART010_ICR);
++ __raw_writel(0, uap->port.membase + UART010_ICR);
+
+- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ delta = status ^ uap->old_status;
+ uap->old_status = status;
+@@ -233,7 +232,7 @@ static irqreturn_t pl010_int(int irq, vo
+
+ spin_lock(&uap->port.lock);
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ if (status) {
+ do {
+ if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
+@@ -246,7 +245,7 @@ static irqreturn_t pl010_int(int irq, vo
+ if (pass_counter-- == 0)
+ break;
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
+ UART010_IIR_TIS));
+ handled = 1;
+@@ -260,7 +259,7 @@ static irqreturn_t pl010_int(int irq, vo
+ static unsigned int pl010_tx_empty(struct uart_port *port)
+ {
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+- unsigned int status = readb(uap->port.membase + UART01x_FR);
++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR);
+ return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
+ }
+
+@@ -270,7 +269,7 @@ static unsigned int pl010_get_mctrl(stru
+ unsigned int result = 0;
+ unsigned int status;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ if (status & UART01x_FR_DCD)
+ result |= TIOCM_CAR;
+ if (status & UART01x_FR_DSR)
+@@ -296,12 +295,12 @@ static void pl010_break_ctl(struct uart_
+ unsigned int lcr_h;
+
+ spin_lock_irqsave(&uap->port.lock, flags);
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+ if (break_state == -1)
+ lcr_h |= UART01x_LCRH_BRK;
+ else
+ lcr_h &= ~UART01x_LCRH_BRK;
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+
+@@ -329,12 +328,12 @@ static int pl010_startup(struct uart_por
+ /*
+ * initialise the old status of the modem signals
+ */
+- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ /*
+ * Finally, enable interrupts
+ */
+- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
+ uap->port.membase + UART010_CR);
+
+ return 0;
+@@ -357,10 +356,10 @@ static void pl010_shutdown(struct uart_p
+ /*
+ * disable all interrupts, disable the port
+ */
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* disable break condition and fifos */
+- writel(readb(uap->port.membase + UART010_LCRH) &
++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) &
+ ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
+ uap->port.membase + UART010_LCRH);
+
+@@ -382,7 +381,7 @@ pl010_set_termios(struct uart_port *port
+ /*
+ * Ask the core to calculate the divisor for us.
+ */
+- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
+ quot = uart_get_divisor(port, baud);
+
+ switch (termios->c_cflag & CSIZE) {
+@@ -445,25 +444,25 @@ pl010_set_termios(struct uart_port *port
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
+
+ /* first, disable everything */
+- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
+
+ if (UART_ENABLE_MS(port, termios->c_cflag))
+ old_cr |= UART010_CR_MSIE;
+
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* Set baud rate */
+ quot -= 1;
+- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
+- writel(quot & 0xff, uap->port.membase + UART010_LCRL);
++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL);
+
+ /*
+ * ----------v----------v----------v----------v-----
+ * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
+ * ----------^----------^----------^----------^-----
+ */
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+@@ -545,7 +544,7 @@ static struct uart_ops amba_pl010_pops =
+ .verify_port = pl010_verify_port,
+ };
+
+-static struct uart_amba_port *amba_ports[UART_NR];
++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
+
+ #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
+
+@@ -555,10 +554,10 @@ static void pl010_console_putchar(struct
+ unsigned int status;
+
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (!UART_TX_READY(status));
+- writel(ch, uap->port.membase + UART01x_DR);
++ __raw_writel(ch, uap->port.membase + UART01x_DR);
+ }
+
+ static void
+@@ -572,8 +571,8 @@ pl010_console_write(struct console *co,
+ /*
+ * First save the CR then disable the interrupts
+ */
+- old_cr = readb(uap->port.membase + UART010_CR);
+- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
++ old_cr = __raw_readl(uap->port.membase + UART010_CR);
++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
+
+ uart_console_write(&uap->port, s, count, pl010_console_putchar);
+
+@@ -582,10 +581,10 @@ pl010_console_write(struct console *co,
+ * and restore the TCR
+ */
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (status & UART01x_FR_BUSY);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ clk_disable(uap->clk);
+ }
+@@ -594,9 +593,9 @@ static void __init
+ pl010_console_get_options(struct uart_amba_port *uap, int *baud,
+ int *parity, int *bits)
+ {
+- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
+ unsigned int lcr_h, quot;
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+
+ *parity = 'n';
+ if (lcr_h & UART01x_LCRH_PEN) {
+@@ -611,8 +610,8 @@ pl010_console_get_options(struct uart_am
+ else
+ *bits = 8;
+
+- quot = readb(uap->port.membase + UART010_LCRL) |
+- readb(uap->port.membase + UART010_LCRM) << 8;
++ quot = __raw_readl(uap->port.membase + UART010_LCRL) |
++ __raw_readl(uap->port.membase + UART010_LCRM) << 8;
+ *baud = uap->port.uartclk / (16 * (quot + 1));
+ }
+ }
+@@ -631,7 +630,7 @@ static int __init pl010_console_setup(st
+ * if so, search for the first available port that does have
+ * console support.
+ */
+- if (co->index >= UART_NR)
++ if (co->index >= SERIAL_AMBA_NR)
+ co->index = 0;
+ uap = amba_ports[co->index];
+ if (!uap)
+@@ -653,7 +652,7 @@ static int __init pl010_console_setup(st
+
+ static struct uart_driver amba_reg;
+ static struct console amba_console = {
+- .name = "ttyAM",
++ .name = SERIAL_AMBA_NAME,
+ .write = pl010_console_write,
+ .device = uart_console_device,
+ .setup = pl010_console_setup,
+@@ -669,11 +668,11 @@ static struct console amba_console = {
+
+ static struct uart_driver amba_reg = {
+ .owner = THIS_MODULE,
+- .driver_name = "ttyAM",
+- .dev_name = "ttyAM",
++ .driver_name = SERIAL_AMBA_NAME,
++ .dev_name = SERIAL_AMBA_NAME,
+ .major = SERIAL_AMBA_MAJOR,
+ .minor = SERIAL_AMBA_MINOR,
+- .nr = UART_NR,
++ .nr = SERIAL_AMBA_NR,
+ .cons = AMBA_CONSOLE,
+ };
+
+--- a/drivers/tty/serial/Kconfig
++++ b/drivers/tty/serial/Kconfig
+@@ -25,10 +25,25 @@ config SERIAL_AMBA_PL010
+ help
+ This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
+ an Integrator/AP or Integrator/PP2 platform, or if you have a
+- Cirrus Logic EP93xx CPU, say Y or M here.
++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
+
+ If unsure, say N.
+
++config SERIAL_AMBA_PL010_NUMPORTS
++ int "Maximum number of AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "8"
++ ---help---
++ Set this to the number of serial ports you want the AMBA PL010 driver
++ to support.
++
++config SERIAL_AMBA_PL010_PORTNAME
++ string "Name of the AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "ttyAM"
++ ---help---
++ ::: To be written :::
++
+ config SERIAL_AMBA_PL010_CONSOLE
+ bool "Support for console on AMBA serial port"
+ depends on SERIAL_AMBA_PL010=y
diff --git a/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch b/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch
new file mode 100644
index 0000000..c79721a
--- /dev/null
+++ b/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch
@@ -0,0 +1,13 @@
+--- a/drivers/amba/bus.c
++++ b/drivers/amba/bus.c
+@@ -21,6 +21,10 @@
+
+ #include <asm/irq.h>
+
++#ifndef NO_IRQ
++#define NO_IRQ (-1)
++#endif
++
+ #define to_amba_driver(d) container_of(d, struct amba_driver, drv)
+
+ static const struct amba_id *