aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar7/patches-3.3
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /target/linux/ar7/patches-3.3
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar7/patches-3.3')
-rw-r--r--target/linux/ar7/patches-3.3/110-flash.patch22
-rw-r--r--target/linux/ar7/patches-3.3/120-gpio_chrdev.patch28
-rw-r--r--target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch20
-rw-r--r--target/linux/ar7/patches-3.3/500-serial_kludge.patch28
-rw-r--r--target/linux/ar7/patches-3.3/920-ar7part.patch56
-rw-r--r--target/linux/ar7/patches-3.3/950-cpmac_titan.patch52
-rw-r--r--target/linux/ar7/patches-3.3/972-cpmac_fixup.patch218
7 files changed, 424 insertions, 0 deletions
diff --git a/target/linux/ar7/patches-3.3/110-flash.patch b/target/linux/ar7/patches-3.3/110-flash.patch
new file mode 100644
index 000000000..58ce7eaa4
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/110-flash.patch
@@ -0,0 +1,22 @@
+--- a/drivers/mtd/maps/physmap.c
++++ b/drivers/mtd/maps/physmap.c
+@@ -78,7 +78,7 @@ static const char *rom_probe_types[] = {
+ "map_rom",
+ NULL };
+ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs",
+- NULL };
++ "ar7part", NULL };
+
+ static int physmap_flash_probe(struct platform_device *dev)
+ {
+--- a/drivers/mtd/Makefile
++++ b/drivers/mtd/Makefile
+@@ -10,7 +10,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
+ obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
+ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
+ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
+-obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
++obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o titanpart.o
+ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
+ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
+
diff --git a/target/linux/ar7/patches-3.3/120-gpio_chrdev.patch b/target/linux/ar7/patches-3.3/120-gpio_chrdev.patch
new file mode 100644
index 000000000..006cef4d5
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/120-gpio_chrdev.patch
@@ -0,0 +1,28 @@
+--- a/drivers/char/Kconfig
++++ b/drivers/char/Kconfig
+@@ -478,6 +478,15 @@ config MWAVE
+ To compile this driver as a module, choose M here: the
+ module will be called mwave.
+
++config AR7_GPIO
++ tristate "TI AR7 GPIO Support"
++ depends on AR7
++ help
++ Give userspace access to the GPIO pins on the Texas Instruments AR7
++ processors.
++
++ If compiled as a module, it will be called ar7_gpio.
++
+ config SCx200_GPIO
+ tristate "NatSemi SCx200 GPIO Support"
+ depends on SCx200
+--- a/drivers/char/Makefile
++++ b/drivers/char/Makefile
+@@ -44,6 +44,7 @@ obj-$(CONFIG_HW_RANDOM) += hw_random/
+ obj-$(CONFIG_PPDEV) += ppdev.o
+ obj-$(CONFIG_NWBUTTON) += nwbutton.o
+ obj-$(CONFIG_NWFLASH) += nwflash.o
++obj-$(CONFIG_AR7_GPIO) += ar7_gpio.o
+ obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
+ obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o
+ obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o
diff --git a/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch b/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch
new file mode 100644
index 000000000..437bc89d9
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch
@@ -0,0 +1,20 @@
+--- a/drivers/vlynq/vlynq.c
++++ b/drivers/vlynq/vlynq.c
+@@ -514,9 +514,14 @@ static int __vlynq_enable_device(struct
+ !__vlynq_try_external(dev))
+ return 0;
+ } else {
+- if (!__vlynq_try_external(dev) ||
+- !__vlynq_try_local(dev) ||
+- !__vlynq_try_remote(dev))
++ /* XXX: I don't really know what difference it makes, if the order
++ * of the following calls is changed, but at least in this order
++ * my fritzbox doesn't hang at startup as in
++ * https://dev.openwrt.org/ticket/7324
++ */
++ if (!__vlynq_try_remote(dev) ||
++ !__vlynq_try_local(dev) ||
++ !__vlynq_try_external(dev))
+ return 0;
+ }
+ break;
diff --git a/target/linux/ar7/patches-3.3/500-serial_kludge.patch b/target/linux/ar7/patches-3.3/500-serial_kludge.patch
new file mode 100644
index 000000000..5c19cf22b
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/500-serial_kludge.patch
@@ -0,0 +1,28 @@
+--- a/drivers/tty/serial/8250/8250.c
++++ b/drivers/tty/serial/8250/8250.c
+@@ -290,6 +290,13 @@ static const struct serial8250_config ua
+ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
+ .flags = UART_CAP_FIFO | UART_CAP_AFE | UART_CAP_EFR,
+ },
++ [PORT_AR7] = {
++ .name = "TI-AR7",
++ .fifo_size = 16,
++ .tx_loadsz = 16,
++ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00,
++ .flags = UART_CAP_FIFO | UART_CAP_AFE,
++ },
+ };
+
+ #if defined(CONFIG_MIPS_ALCHEMY)
+@@ -2798,7 +2805,11 @@ static void serial8250_console_putchar(s
+ struct uart_8250_port *up =
+ container_of(port, struct uart_8250_port, port);
+
++#ifdef CONFIG_AR7
++ wait_for_xmitr(up, BOTH_EMPTY);
++#else
+ wait_for_xmitr(up, UART_LSR_THRE);
++#endif
+ serial_out(up, UART_TX, ch);
+ }
+
diff --git a/target/linux/ar7/patches-3.3/920-ar7part.patch b/target/linux/ar7/patches-3.3/920-ar7part.patch
new file mode 100644
index 000000000..9cbc53786
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/920-ar7part.patch
@@ -0,0 +1,56 @@
+--- a/drivers/mtd/ar7part.c
++++ b/drivers/mtd/ar7part.c
+@@ -29,11 +29,14 @@
+ #include <linux/magic.h>
+ #include <linux/module.h>
+
++#include <asm/mach-ar7/prom.h>
++
+ #define AR7_PARTS 4
+ #define ROOT_OFFSET 0xe0000
+
+ #define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42)
+ #define LOADER_MAGIC2 le32_to_cpu(0xfeed1281)
++#define LOADER_MAGIC3 le32_to_cpu(0x434d4d4c)
+
+ #ifndef SQUASHFS_MAGIC
+ #define SQUASHFS_MAGIC 0x73717368
+@@ -45,6 +48,10 @@ struct ar7_bin_rec {
+ unsigned int address;
+ };
+
++int create_titan_partitions(struct mtd_info *master,
++ struct mtd_partition **pparts,
++ struct mtd_part_parser_data *data);
++
+ static int create_mtd_partitions(struct mtd_info *master,
+ struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+@@ -58,6 +65,16 @@ static int create_mtd_partitions(struct
+ int retries = 10;
+ struct mtd_partition *ar7_parts;
+
++ const char *prod_id ;
++ prod_id = prom_getenv("ProductID");
++ if(prod_id &&
++ (strcmp(prod_id, "CYWL")==0 ||
++ strcmp(prod_id, "CYWM")==0 ||
++ strcmp(prod_id, "CYLM")==0 ||
++ strcmp(prod_id, "CYLL")==0)){
++ return create_titan_partitions(master, pparts, data);
++ }
++
+ ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL);
+ if (!ar7_parts)
+ return -ENOMEM;
+--- a/drivers/mtd/titanpart.c
++++ b/drivers/mtd/titanpart.c
+@@ -149,7 +149,7 @@ static void titan_add_partition(char * e
+ }
+ int create_titan_partitions(struct mtd_info *master,
+ struct mtd_partition **pparts,
+- unsigned long origin)
++ struct mtd_part_parser_data *data)
+ {
+ struct nsp_img_hdr_head hdr;
+ struct nsp_img_hdr_section_info sect_info;
diff --git a/target/linux/ar7/patches-3.3/950-cpmac_titan.patch b/target/linux/ar7/patches-3.3/950-cpmac_titan.patch
new file mode 100644
index 000000000..a829e4e8c
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/950-cpmac_titan.patch
@@ -0,0 +1,52 @@
+--- a/drivers/net/ethernet/ti/cpmac.c
++++ b/drivers/net/ethernet/ti/cpmac.c
+@@ -1159,6 +1159,8 @@ static int __devinit cpmac_probe(struct
+ goto fail;
+ }
+
++ ar7_device_reset(pdata->reset_bit);
++
+ dev->irq = platform_get_irq_byname(pdev, "irq");
+
+ dev->netdev_ops = &cpmac_netdev_ops;
+@@ -1237,7 +1239,7 @@ int __devinit cpmac_init(void)
+ cpmac_mii->reset = cpmac_mdio_reset;
+ cpmac_mii->irq = mii_irqs;
+
+- cpmac_mii->priv = ioremap(AR7_REGS_MDIO, 256);
++ cpmac_mii->priv = ioremap(ar7_is_titan() ? TITAN_REGS_MDIO : AR7_REGS_MDIO, 256);
+
+ if (!cpmac_mii->priv) {
+ printk(KERN_ERR "Can't ioremap mdio registers\n");
+@@ -1248,10 +1250,16 @@ int __devinit cpmac_init(void)
+ #warning FIXME: unhardcode gpio&reset bits
+ ar7_gpio_disable(26);
+ ar7_gpio_disable(27);
+- ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
+- ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
++
++ if (!ar7_is_titan()) {
++ ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
++ ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
++ }
+ ar7_device_reset(AR7_RESET_BIT_EPHY);
+
++ if (ar7_is_titan())
++ ar7_device_reset(TITAN_RESET_BIT_EPHY1);
++
+ cpmac_mii->reset(cpmac_mii);
+
+ for (i = 0; i < 300; i++) {
+@@ -1268,7 +1276,11 @@ int __devinit cpmac_init(void)
+ mask = 0;
+ }
+
+- cpmac_mii->phy_mask = ~(mask | 0x80000000);
++ if (ar7_is_titan())
++ cpmac_mii->phy_mask = ~(mask | 0x80000000 | 0x40000000);
++ else
++ cpmac_mii->phy_mask = ~(mask | 0x80000000);
++
+ snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "cpmac-1");
+
+ res = mdiobus_register(cpmac_mii);
diff --git a/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch b/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch
new file mode 100644
index 000000000..b1eb081c9
--- /dev/null
+++ b/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch
@@ -0,0 +1,218 @@
+--- a/arch/mips/ar7/platform.c
++++ b/arch/mips/ar7/platform.c
+@@ -33,7 +33,6 @@
+ #include <linux/string.h>
+ #include <linux/etherdevice.h>
+ #include <linux/phy.h>
+-#include <linux/phy_fixed.h>
+ #include <linux/gpio.h>
+ #include <linux/clk.h>
+
+@@ -248,12 +247,6 @@ static struct resource cpmac_high_res[]
+ },
+ };
+
+-static struct fixed_phy_status fixed_phy_status __initdata = {
+- .link = 1,
+- .speed = 100,
+- .duplex = 1,
+-};
+-
+ static struct plat_cpmac_data cpmac_low_data = {
+ .reset_bit = 17,
+ .power_bit = 20,
+@@ -680,26 +673,18 @@ static int __init ar7_register_devices(v
+ }
+
+ if (ar7_has_high_cpmac()) {
+- res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
+- if (!res) {
+- cpmac_get_mac(1, cpmac_high_data.dev_addr);
+-
+- res = platform_device_register(&cpmac_high);
+- if (res)
+- pr_warning("unable to register cpmac-high: %d\n", res);
+- } else
+- pr_warning("unable to add cpmac-high phy: %d\n", res);
+- } else
+- cpmac_low_data.phy_mask = 0xffffffff;
++ cpmac_get_mac(1, cpmac_high_data.dev_addr);
+
+- res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
+- if (!res) {
+- cpmac_get_mac(0, cpmac_low_data.dev_addr);
+- res = platform_device_register(&cpmac_low);
++ res = platform_device_register(&cpmac_high);
+ if (res)
+- pr_warning("unable to register cpmac-low: %d\n", res);
++ pr_warning("unable to register cpmac-high: %d\n", res);
+ } else
+- pr_warning("unable to add cpmac-low phy: %d\n", res);
++ cpmac_low_data.phy_mask = 0xffffffff;
++
++ cpmac_get_mac(0, cpmac_low_data.dev_addr);
++ res = platform_device_register(&cpmac_low);
++ if (res)
++ pr_warning("unable to register cpmac-low: %d\n", res);
+
+ detect_leds();
+ res = platform_device_register(&ar7_gpio_leds);
+@@ -712,8 +697,10 @@ static int __init ar7_register_devices(v
+
+ /* Register watchdog only if enabled in hardware */
+ bootcr = ioremap_nocache(AR7_REGS_DCL, 4);
+- val = readl(bootcr);
+- iounmap(bootcr);
++ if (bootcr) {
++ val = readl(bootcr);
++ iounmap(bootcr);
++ }
+ if (val & AR7_WDT_HW_ENA) {
+ if (ar7_has_high_vlynq())
+ ar7_wdt_res.start = UR8_REGS_WDT;
+--- a/arch/mips/include/asm/mach-ar7/ar7.h
++++ b/arch/mips/include/asm/mach-ar7/ar7.h
+@@ -42,6 +42,7 @@
+ #define AR7_REGS_PINSEL (AR7_REGS_BASE + 0x160C)
+ #define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
+ #define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
++#define AR7_REGS_MII (AR7_REGS_BASE + 0x1a08)
+ #define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
+ #define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
+ #define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
+--- a/drivers/net/ethernet/ti/cpmac.c
++++ b/drivers/net/ethernet/ti/cpmac.c
+@@ -35,7 +35,6 @@
+ #include <linux/skbuff.h>
+ #include <linux/mii.h>
+ #include <linux/phy.h>
+-#include <linux/phy_fixed.h>
+ #include <linux/platform_device.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/clk.h>
+@@ -48,14 +47,11 @@ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("platform:cpmac");
+
+ static int debug_level = 8;
+-static int dumb_switch;
+
+-/* Next 2 are only used in cpmac_probe, so it's pointless to change them */
++/* Next is only used in cpmac_probe, so it's pointless to change them */
+ module_param(debug_level, int, 0444);
+-module_param(dumb_switch, int, 0444);
+
+ MODULE_PARM_DESC(debug_level, "Number of NETIF_MSG bits to enable");
+-MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
+
+ #define CPMAC_VERSION "0.5.2"
+ /* frame size + 802.1q tag + FCS size */
+@@ -674,9 +670,8 @@ static void cpmac_hw_start(struct net_de
+ for (i = 0; i < 8; i++)
+ cpmac_write(priv->regs, CPMAC_MAC_ADDR_LO(i), dev->dev_addr[5]);
+ cpmac_write(priv->regs, CPMAC_MAC_ADDR_MID, dev->dev_addr[4]);
+- cpmac_write(priv->regs, CPMAC_MAC_ADDR_HI, dev->dev_addr[0] |
+- (dev->dev_addr[1] << 8) | (dev->dev_addr[2] << 16) |
+- (dev->dev_addr[3] << 24));
++ cpmac_write(priv->regs, CPMAC_MAC_ADDR_HI, be32_to_cpu(*(u32 *)
++ dev->dev_addr));
+ cpmac_write(priv->regs, CPMAC_MAX_LENGTH, CPMAC_SKB_SIZE);
+ cpmac_write(priv->regs, CPMAC_UNICAST_CLEAR, 0xff);
+ cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 0xff);
+@@ -1108,8 +1103,6 @@ static const struct net_device_ops cpmac
+ .ndo_set_mac_address = eth_mac_addr,
+ };
+
+-static int external_switch;
+-
+ static int __devinit cpmac_probe(struct platform_device *pdev)
+ {
+ int rc, phy_id;
+@@ -1121,25 +1114,18 @@ static int __devinit cpmac_probe(struct
+
+ pdata = pdev->dev.platform_data;
+
+- if (external_switch || dumb_switch) {
+- strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
+- phy_id = pdev->id;
+- } else {
+- for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
+- if (!(pdata->phy_mask & (1 << phy_id)))
+- continue;
+- if (!cpmac_mii->phy_map[phy_id])
+- continue;
+- strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
+- break;
+- }
++ for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
++ if (!(pdata->phy_mask & (1 << phy_id)))
++ continue;
++ if (!cpmac_mii->phy_map[phy_id])
++ continue;
++ strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
++ break;
+ }
+
+ if (phy_id == PHY_MAX_ADDR) {
+- dev_err(&pdev->dev, "no PHY present, falling back "
+- "to switch on MDIO bus 0\n");
+- strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
+- phy_id = pdev->id;
++ printk(KERN_ERR "cpmac: No PHY present\n");
++ return -ENXIO;
+ }
+
+ dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
+@@ -1228,6 +1214,7 @@ int __devinit cpmac_init(void)
+ {
+ u32 mask;
+ int i, res;
++ void __iomem *mii_reg;
+
+ cpmac_mii = mdiobus_alloc();
+ if (cpmac_mii == NULL)
+@@ -1251,14 +1238,14 @@ int __devinit cpmac_init(void)
+ ar7_gpio_disable(26);
+ ar7_gpio_disable(27);
+
+- if (!ar7_is_titan()) {
++ if (ar7_is_titan()) {
++ ar7_device_reset(AR7_RESET_BIT_EPHY);
++ ar7_device_reset(TITAN_RESET_BIT_EPHY1);
++ } else {
++ ar7_device_reset(AR7_RESET_BIT_EPHY);
+ ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
+ ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
+ }
+- ar7_device_reset(AR7_RESET_BIT_EPHY);
+-
+- if (ar7_is_titan())
+- ar7_device_reset(TITAN_RESET_BIT_EPHY1);
+
+ cpmac_mii->reset(cpmac_mii);
+
+@@ -1270,10 +1257,22 @@ int __devinit cpmac_init(void)
+ msleep(10);
+ }
+
+- mask &= 0x7fffffff;
++ mask &= ar7_is_titan()? ~(0x80000000 | 0x40000000) : ~(0x80000000);
+ if (mask & (mask - 1)) {
+- external_switch = 1;
+- mask = 0;
++ if (!ar7_has_high_cpmac()) {
++ if (ar7_is_titan()) {
++ ar7_device_disable(AR7_RESET_BIT_EPHY);
++ ar7_device_disable(TITAN_RESET_BIT_EPHY1);
++ } else
++ ar7_device_disable(AR7_RESET_BIT_EPHY);
++
++ //Titan remap might be different
++ mii_reg = ioremap(AR7_REGS_MII, 4);
++ if (mii_reg) {
++ writel(readl(mii_reg) | 1, mii_reg);
++ iounmap(mii_reg);
++ }
++ }
+ }
+
+ if (ar7_is_titan())