From db7d33cfd7ed93c1c4a58320589b142f4348284a Mon Sep 17 00:00:00 2001 From: James <> Date: Tue, 11 Feb 2014 11:49:23 +0000 Subject: fish --- master/tpl3040-always-bitbang-spi | 177 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 master/tpl3040-always-bitbang-spi (limited to 'master/tpl3040-always-bitbang-spi') diff --git a/master/tpl3040-always-bitbang-spi b/master/tpl3040-always-bitbang-spi new file mode 100644 index 0000000..46199eb --- /dev/null +++ b/master/tpl3040-always-bitbang-spi @@ -0,0 +1,177 @@ +diff --git a/target/linux/ar71xx/patches-3.8/999-1-always-bitbang-spi b/target/linux/ar71xx/patches-3.8/999-1-always-bitbang-spi +new file mode 100644 +index 0000000..44cd2f2 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.8/999-1-always-bitbang-spi +@@ -0,0 +1,171 @@ ++Index: linux-3.8.3/drivers/spi/spi-ath79.c ++=================================================================== ++--- linux-3.8.3.orig/drivers/spi/spi-ath79.c +++++ linux-3.8.3/drivers/spi/spi-ath79.c ++@@ -282,7 +282,11 @@ static int ath79_spi_do_read_flash_cmd(s ++ static bool ath79_spi_is_read_cmd(struct spi_device *spi, ++ struct spi_transfer *t) ++ { +++#if 0 ++ return t->type == SPI_TRANSFER_FLASH_READ_CMD; +++#else +++ return 1 == 0; +++#endif ++ } ++ ++ static bool ath79_spi_is_data_read(struct spi_device *spi, ++Index: linux-3.8.3/drivers/mtd/tplinkpart.c ++=================================================================== ++--- linux-3.8.3.orig/drivers/mtd/tplinkpart.c +++++ linux-3.8.3/drivers/mtd/tplinkpart.c ++@@ -162,7 +162,7 @@ static int tplink_parse_partitions(struc ++ parts[3].name = "art"; ++ parts[3].offset = art_offset; ++ parts[3].size = TPLINK_ART_LEN; ++- parts[3].mask_flags = MTD_WRITEABLE; +++ //parts[3].mask_flags = MTD_WRITEABLE; ++ ++ parts[4].name = "firmware"; ++ parts[4].offset = offset; ++Index: linux-3.8.3/drivers/mtd/devices/m25p80.c ++=================================================================== ++--- linux-3.8.3.orig/drivers/mtd/devices/m25p80.c +++++ linux-3.8.3/drivers/mtd/devices/m25p80.c ++@@ -94,6 +94,7 @@ struct m25p { ++ u8 *command; ++ bool fast_read; ++ size_t max_read_len; +++ u32 jedec_id; ++ }; ++ ++ static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd) ++@@ -914,6 +915,7 @@ static int m25p_probe(struct spi_device ++ } ++ ++ flash->spi = spi; +++ flash->jedec_id = info->jedec_id; ++ mutex_init(&flash->lock); ++ dev_set_drvdata(&spi->dev, flash); ++ ++@@ -990,7 +992,7 @@ static int m25p_probe(struct spi_device ++ /* enable 4-byte addressing if the device exceeds 16MiB */ ++ if (flash->mtd.size > 0x1000000) { ++ flash->addr_width = 4; ++- set_4byte(flash, info->jedec_id, 1); +++ set_4byte(flash, flash->jedec_id, 1); ++ } else ++ flash->addr_width = 3; ++ } ++@@ -1030,8 +1032,14 @@ static int m25p_probe(struct spi_device ++ static int m25p_remove(struct spi_device *spi) ++ { ++ struct m25p *flash = dev_get_drvdata(&spi->dev); +++ struct flash_info *info; ++ int status; ++ +++ if (flash->addr_width == 4) { +++ printk(KERN_ERR "Switching flash back into 3 byte mode for boot\n"); +++ set_4byte(flash, flash->jedec_id, 0); +++ } +++ ++ /* Clean up MTD stuff. */ ++ status = mtd_device_unregister(&flash->mtd); ++ if (status == 0) { ++Index: linux-3.8.3/arch/mips/ath79/mach-tl-mr11u.c ++=================================================================== ++--- linux-3.8.3.orig/arch/mips/ath79/mach-tl-mr11u.c +++++ linux-3.8.3/arch/mips/ath79/mach-tl-mr11u.c ++@@ -13,6 +13,8 @@ ++ ++ #include ++ #include +++#include +++#include ++ ++ #include "common.h" ++ #include "dev-eth.h" ++@@ -82,11 +84,60 @@ static struct gpio_keys_button tl_mr11u_ ++ }, ++ }; ++ ++-static void __init common_setup(void) +++#define MAC_LEN 6 +++#define ART_LEN (ATH9K_PLAT_EEP_MAX_WORDS << 1) +++ +++#define CONFIG_OFFSET 0x1fc00 +++#define ART_OFFSET 0x1000 +++ +++static u8 *mac, *art; +++ +++static void notify_add(struct mtd_info *mtd) +++{ +++ size_t len; +++ +++ if (!strcmp(mtd->name, "u-boot") && !mac) { +++ mac = kmalloc(MAC_LEN, GFP_KERNEL); +++ if (!mac) return; +++ +++ mtd_read(mtd, CONFIG_OFFSET, MAC_LEN, &len, mac); +++ +++ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); +++ ath79_register_mdio(0, 0x0); +++ ath79_register_eth(0); +++ ath79_eth0_data.phy_mask = BIT(0); +++ +++ } +++ +++ if (!strcmp(mtd->name, "art") && !art) { +++ art = kmalloc(ART_LEN, GFP_KERNEL); +++ if (!art) return; +++ +++ mtd_read(mtd, ART_OFFSET, ART_LEN, &len, art); +++ } +++ +++ +++ if (mac && art) { +++ ath79_register_wmac(art , mac); +++ kfree(mac); +++ kfree(art); +++ +++ art = NULL; +++ mac = NULL; +++ } +++} +++ +++static void notify_remove(struct mtd_info *mtd) ++ { ++- u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); ++- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); +++} +++ +++static struct mtd_notifier spi_notifier = { +++ .add = notify_add, +++ .remove = notify_remove +++}; ++ +++static void __init common_setup(void) +++{ ++ /* Disable hardware control LAN1 and LAN2 LEDs, enabling GPIO14 and GPIO15 */ ++ ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN); ++@@ -94,18 +145,13 @@ static void __init common_setup(void) ++ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ ++ ath79_setup_ar933x_phy4_switch(false, false); ++ +++ register_mtd_user(&spi_notifier); +++ ++ ath79_register_m25p80(&tl_mr11u_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr11u_leds_gpio), ++ tl_mr11u_leds_gpio); ++ ++ ath79_register_usb(); ++- ++- ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); ++- ++- ath79_register_mdio(0, 0x0); ++- ath79_register_eth(0); ++- ++- ath79_register_wmac(ee, mac); ++ } ++ ++ static void __init tl_mr11u_setup(void) -- cgit v1.2.3