diff options
Diffstat (limited to 'target/linux/gemini/patches')
13 files changed, 1029 insertions, 0 deletions
diff --git a/target/linux/gemini/patches/050-gpio-to-irq.patch b/target/linux/gemini/patches/050-gpio-to-irq.patch new file mode 100644 index 0000000..7572849 --- /dev/null +++ b/target/linux/gemini/patches/050-gpio-to-irq.patch @@ -0,0 +1,21 @@ +--- a/arch/arm/mach-gemini/gpio.c ++++ b/arch/arm/mach-gemini/gpio.c +@@ -196,12 +196,18 @@ static int gemini_gpio_direction_output( + return 0; + } + ++static int gemini_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) ++{ ++ return gpio + GPIO_IRQ_BASE; ++} ++ + static struct gpio_chip gemini_gpio_chip = { + .label = "Gemini", + .direction_input = gemini_gpio_direction_input, + .get = gemini_gpio_get, + .direction_output = gemini_gpio_direction_output, + .set = gemini_gpio_set, ++ .to_irq = gemini_gpio_to_irq, + .base = 0, + .ngpio = GPIO_PORT_NUM * 32, + }; diff --git a/target/linux/gemini/patches/060-cache-fa.diff b/target/linux/gemini/patches/060-cache-fa.diff new file mode 100644 index 0000000..fc74c0a --- /dev/null +++ b/target/linux/gemini/patches/060-cache-fa.diff @@ -0,0 +1,41 @@ +--- a/arch/arm/mm/cache-fa.S ++++ b/arch/arm/mm/cache-fa.S +@@ -24,7 +24,8 @@ + /* + * The size of one data cache line. + */ +-#define CACHE_DLINESIZE 16 ++#define CACHE_DLINESIZE 16 ++#define CACHE_DLINESHIFT 4 + + /* + * The total size of the data cache. +@@ -169,7 +170,17 @@ ENTRY(fa_flush_kern_dcache_area) + * - start - virtual start address + * - end - virtual end address + */ ++__flush_whole_dcache: ++ mcr p15, 0, r0, c7, c14, 0 @ clean/invalidate D cache ++ mov r0, #0 ++ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer ++ mov pc, lr ++ + fa_dma_inv_range: ++ sub r3, r1, r0 @ calculate total size ++ cmp r3, #CACHE_DLIMIT @ total size >= limit? ++ bhs __flush_whole_dcache @ flush whole D cache ++ + tst r0, #CACHE_DLINESIZE - 1 + bic r0, r0, #CACHE_DLINESIZE - 1 + mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D entry +@@ -193,6 +204,10 @@ fa_dma_inv_range: + * - end - virtual end address + */ + fa_dma_clean_range: ++ sub r3, r1, r0 @ calculate total size ++ cmp r3, #CACHE_DLIMIT @ total size >= limit? ++ bhs __flush_whole_dcache @ flush whole D cache ++ + bic r0, r0, #CACHE_DLINESIZE - 1 + 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #CACHE_DLINESIZE diff --git a/target/linux/gemini/patches/110-watchdog-add-gemini_wdt-driver.patch b/target/linux/gemini/patches/110-watchdog-add-gemini_wdt-driver.patch new file mode 100644 index 0000000..bb66ae4 --- /dev/null +++ b/target/linux/gemini/patches/110-watchdog-add-gemini_wdt-driver.patch @@ -0,0 +1,29 @@ +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -229,6 +229,16 @@ config 977_WATCHDOG + + Not sure? It's safe to say N. + ++config GEMINI_WATCHDOG ++ tristate "Gemini watchdog" ++ depends on ARCH_GEMINI ++ help ++ Say Y here if to include support for the watchdog timer ++ embedded in the Cortina Systems Gemini family of devices. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called gemini_wdt. ++ + config IXP4XX_WATCHDOG + tristate "IXP4xx Watchdog" + depends on ARCH_IXP4XX +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -37,6 +37,7 @@ obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt. + obj-$(CONFIG_TWL4030_WATCHDOG) += twl4030_wdt.o + obj-$(CONFIG_21285_WATCHDOG) += wdt285.o + obj-$(CONFIG_977_WATCHDOG) += wdt977.o ++obj-$(CONFIG_GEMINI_WATCHDOG) += gemini_wdt.o + obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o + obj-$(CONFIG_KS8695_WATCHDOG) += ks8695_wdt.o + obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o diff --git a/target/linux/gemini/patches/111-arm-gemini-add-watchdog-device.patch b/target/linux/gemini/patches/111-arm-gemini-add-watchdog-device.patch new file mode 100644 index 0000000..ab32e9e --- /dev/null +++ b/target/linux/gemini/patches/111-arm-gemini-add-watchdog-device.patch @@ -0,0 +1,33 @@ +--- a/arch/arm/mach-gemini/devices.c ++++ b/arch/arm/mach-gemini/devices.c +@@ -116,3 +116,20 @@ int __init platform_register_rtc(void) + return platform_device_register(&gemini_rtc_device); + } + ++static struct resource wdt_resource = { ++ .start = GEMINI_WAQTCHDOG_BASE, ++ .end = GEMINI_WAQTCHDOG_BASE + 0x18, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device wdt_device = { ++ .name = "gemini-wdt", ++ .id = 0, ++ .resource = &wdt_resource, ++ .num_resources = 1, ++}; ++ ++int __init platform_register_watchdog(void) ++{ ++ return platform_device_register(&wdt_device); ++} +--- a/arch/arm/mach-gemini/common.h ++++ b/arch/arm/mach-gemini/common.h +@@ -27,6 +27,7 @@ extern int platform_register_uart(void); + extern int platform_register_pflash(unsigned int size, + struct mtd_partition *parts, + unsigned int nr_parts); ++extern int platform_register_watchdog(void); + + extern void gemini_restart(enum reboot_mode mode, const char *cmd); + diff --git a/target/linux/gemini/patches/112-arm-gemini-register-watchdog-devices.patch b/target/linux/gemini/patches/112-arm-gemini-register-watchdog-devices.patch new file mode 100644 index 0000000..d7660be --- /dev/null +++ b/target/linux/gemini/patches/112-arm-gemini-register-watchdog-devices.patch @@ -0,0 +1,40 @@ +--- a/arch/arm/mach-gemini/board-nas4220b.c ++++ b/arch/arm/mach-gemini/board-nas4220b.c +@@ -94,6 +94,7 @@ static void __init ib4220b_init(void) + platform_device_register(&ib4220b_led_device); + platform_device_register(&ib4220b_key_device); + platform_register_rtc(); ++ platform_register_watchdog(); + } + + MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") +--- a/arch/arm/mach-gemini/board-wbd111.c ++++ b/arch/arm/mach-gemini/board-wbd111.c +@@ -121,6 +121,7 @@ static void __init wbd111_init(void) + platform_device_register(&wbd111_leds_device); + platform_device_register(&wbd111_keys_device); + platform_register_rtc(); ++ platform_register_watchdog(); + } + + MACHINE_START(WBD111, "Wiliboard WBD-111") +--- a/arch/arm/mach-gemini/board-wbd222.c ++++ b/arch/arm/mach-gemini/board-wbd222.c +@@ -121,6 +121,7 @@ static void __init wbd222_init(void) + platform_device_register(&wbd222_leds_device); + platform_device_register(&wbd222_keys_device); + platform_register_rtc(); ++ platform_register_watchdog(); + } + + MACHINE_START(WBD222, "Wiliboard WBD-222") +--- a/arch/arm/mach-gemini/board-rut1xx.c ++++ b/arch/arm/mach-gemini/board-rut1xx.c +@@ -80,6 +80,7 @@ static void __init rut1xx_init(void) + platform_device_register(&rut1xx_leds); + platform_device_register(&rut1xx_keys_device); + platform_register_rtc(); ++ platform_register_watchdog(); + } + + MACHINE_START(RUT100, "Teltonika RUT100") diff --git a/target/linux/gemini/patches/120-net-add-gemini-gmac-driver.patch b/target/linux/gemini/patches/120-net-add-gemini-gmac-driver.patch new file mode 100644 index 0000000..be11ae2 --- /dev/null +++ b/target/linux/gemini/patches/120-net-add-gemini-gmac-driver.patch @@ -0,0 +1,20 @@ +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -73,6 +73,7 @@ source "drivers/net/ethernet/neterion/Kc + source "drivers/net/ethernet/faraday/Kconfig" + source "drivers/net/ethernet/freescale/Kconfig" + source "drivers/net/ethernet/fujitsu/Kconfig" ++source "drivers/net/ethernet/gemini/Kconfig" + source "drivers/net/ethernet/hisilicon/Kconfig" + source "drivers/net/ethernet/hp/Kconfig" + source "drivers/net/ethernet/ibm/Kconfig" +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -36,6 +36,7 @@ obj-$(CONFIG_NET_VENDOR_EXAR) += neterio + obj-$(CONFIG_NET_VENDOR_FARADAY) += faraday/ + obj-$(CONFIG_NET_VENDOR_FREESCALE) += freescale/ + obj-$(CONFIG_NET_VENDOR_FUJITSU) += fujitsu/ ++obj-$(CONFIG_NET_VENDOR_GEMINI) += gemini/ + obj-$(CONFIG_NET_VENDOR_HISILICON) += hisilicon/ + obj-$(CONFIG_NET_VENDOR_HP) += hp/ + obj-$(CONFIG_NET_VENDOR_IBM) += ibm/ diff --git a/target/linux/gemini/patches/121-arm-gemini-add-gmac-device.patch b/target/linux/gemini/patches/121-arm-gemini-add-gmac-device.patch new file mode 100644 index 0000000..6e77224 --- /dev/null +++ b/target/linux/gemini/patches/121-arm-gemini-add-gmac-device.patch @@ -0,0 +1,85 @@ +--- a/arch/arm/mach-gemini/common.h ++++ b/arch/arm/mach-gemini/common.h +@@ -15,6 +15,7 @@ + #include <linux/reboot.h> + + struct mtd_partition; ++struct gemini_gmac_platform_data; + + extern void gemini_map_io(void); + extern void gemini_init_irq(void); +@@ -28,6 +29,7 @@ extern int platform_register_pflash(unsi + struct mtd_partition *parts, + unsigned int nr_parts); + extern int platform_register_watchdog(void); ++extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata); + + extern void gemini_restart(enum reboot_mode mode, const char *cmd); + +--- a/arch/arm/mach-gemini/devices.c ++++ b/arch/arm/mach-gemini/devices.c +@@ -17,6 +17,7 @@ + #include <mach/irqs.h> + #include <mach/hardware.h> + #include <mach/global_reg.h> ++#include <mach/gmac.h> + + static struct plat_serial8250_port serial_platform_data[] = { + { +@@ -133,3 +134,56 @@ int __init platform_register_watchdog(vo + { + return platform_device_register(&wdt_device); + } ++ ++static struct resource gmac_resources[] = { ++ { ++ .start = GEMINI_TOE_BASE, ++ .end = GEMINI_TOE_BASE + 0xffff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IRQ_GMAC0, ++ .end = IRQ_GMAC0, ++ .flags = IORESOURCE_IRQ, ++ }, ++ { ++ .start = IRQ_GMAC1, ++ .end = IRQ_GMAC1, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 gmac_dmamask = 0xffffffffUL; ++ ++static struct platform_device ethernet_device = { ++ .name = "gmac-gemini", ++ .id = 0, ++ .dev = { ++ .dma_mask = &gmac_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++ .num_resources = ARRAY_SIZE(gmac_resources), ++ .resource = gmac_resources, ++}; ++ ++int platform_register_ethernet(struct gemini_gmac_platform_data *pdata) ++{ ++ unsigned int reg; ++ ++ reg = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++ ++ reg &= ~(GMAC_GMII | GMAC_1_ENABLE); ++ ++ if (pdata->bus_id[1]) ++ reg |= GMAC_1_ENABLE; ++ else if (pdata->interface[0] == PHY_INTERFACE_MODE_GMII) ++ reg |= GMAC_GMII; ++ ++ writel(reg, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++ ++ ethernet_device.dev.platform_data = pdata; ++ ++ return platform_device_register(ðernet_device); ++} diff --git a/target/linux/gemini/patches/122-arm-gemini-register-ethernet.patch b/target/linux/gemini/patches/122-arm-gemini-register-ethernet.patch new file mode 100644 index 0000000..1cd9efc --- /dev/null +++ b/target/linux/gemini/patches/122-arm-gemini-register-ethernet.patch @@ -0,0 +1,227 @@ +--- a/arch/arm/mach-gemini/board-nas4220b.c ++++ b/arch/arm/mach-gemini/board-nas4220b.c +@@ -19,6 +19,7 @@ + #include <linux/input.h> + #include <linux/gpio_keys.h> + #include <linux/io.h> ++#include <linux/platform_data/mdio-gpio.h> + + #include <asm/setup.h> + #include <asm/mach-types.h> +@@ -27,9 +28,27 @@ + + #include <mach/hardware.h> + #include <mach/global_reg.h> ++#include <mach/gmac.h> + + #include "common.h" + ++static struct mdio_gpio_platform_data ib4220b_mdio = { ++ .mdc = 22, ++ .mdio = 21, ++ .phy_mask = ~(1 << 1), ++}; ++ ++static struct platform_device ib4220b_phy_device = { ++ .name = "mdio-gpio", ++ .id = 0, ++ .dev = { .platform_data = &ib4220b_mdio, }, ++}; ++ ++static struct gemini_gmac_platform_data ib4220b_gmac_data = { ++ .bus_id[0] = "gpio-0:01", ++ .interface[0] = PHY_INTERFACE_MODE_RGMII, ++}; ++ + static struct gpio_led ib4220b_leds[] = { + { + .name = "nas4220b:orange:hdd", +@@ -86,15 +105,47 @@ static struct platform_device ib4220b_ke + }, + }; + ++static void __init ib4220b_gmac_init(void) ++{ ++ unsigned int val; ++ ++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_IO_DRIVING_CTRL)); ++ val |= (0x3 << GMAC0_PADS_SHIFT) | (0x3 << GMAC1_PADS_SHIFT); ++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_IO_DRIVING_CTRL)); ++ ++ val = (0x0 << GMAC0_RXDV_SKEW_SHIFT) | (0xf << GMAC0_RXC_SKEW_SHIFT) | ++ (0x7 << GMAC0_TXEN_SKEW_SHIFT) | (0xb << GMAC0_TXC_SKEW_SHIFT) | ++ (0x0 << GMAC1_RXDV_SKEW_SHIFT) | (0xf << GMAC1_RXC_SKEW_SHIFT) | ++ (0x7 << GMAC1_TXEN_SKEW_SHIFT) | (0xa << GMAC1_TXC_SKEW_SHIFT); ++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_GMAC_CTRL_SKEW_CTRL)); ++ ++ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_GMAC0_DATA_SKEW_CTRL)); ++ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_GMAC1_DATA_SKEW_CTRL)); ++ ++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_ARBITRATION1_CTRL)) & ~BURST_LENGTH_MASK; ++ val |= (0x20 << BURST_LENGTH_SHIFT) | GMAC0_HIGH_PRIO | GMAC1_HIGH_PRIO; ++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_ARBITRATION1_CTRL)); ++} ++ + static void __init ib4220b_init(void) + { + gemini_gpio_init(); ++ ib4220b_gmac_init(); + platform_register_uart(); + platform_register_pflash(SZ_16M, NULL, 0); + platform_device_register(&ib4220b_led_device); + platform_device_register(&ib4220b_key_device); + platform_register_rtc(); + platform_register_watchdog(); ++ platform_device_register(&ib4220b_phy_device); ++ platform_register_ethernet(&ib4220b_gmac_data); + } + + MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") +--- a/arch/arm/mach-gemini/board-wbd111.c ++++ b/arch/arm/mach-gemini/board-wbd111.c +@@ -17,13 +17,34 @@ + #include <linux/gpio_keys.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/platform_data/mdio-gpio.h> + #include <asm/mach-types.h> + #include <asm/mach/arch.h> + #include <asm/mach/time.h> + ++#include <mach/gmac.h> + + #include "common.h" + ++static struct mdio_gpio_platform_data wbd111_mdio = { ++ .mdc = 22, ++ .mdio = 21, ++ .phy_mask = ~(1 << 1), ++}; ++ ++static struct platform_device wbd111_phy_device = { ++ .name = "mdio-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &wbd111_mdio, ++ }, ++}; ++ ++static struct gemini_gmac_platform_data gmac_data = { ++ .bus_id[0] = "gpio-0:01", ++ .interface[0] = PHY_INTERFACE_MODE_MII, ++}; ++ + static struct gpio_keys_button wbd111_keys[] = { + { + .code = KEY_SETUP, +@@ -122,6 +143,8 @@ static void __init wbd111_init(void) + platform_device_register(&wbd111_keys_device); + platform_register_rtc(); + platform_register_watchdog(); ++ platform_device_register(&wbd111_phy_device); ++ platform_register_ethernet(&gmac_data); + } + + MACHINE_START(WBD111, "Wiliboard WBD-111") +--- a/arch/arm/mach-gemini/board-wbd222.c ++++ b/arch/arm/mach-gemini/board-wbd222.c +@@ -17,13 +17,36 @@ + #include <linux/gpio_keys.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/platform_data/mdio-gpio.h> + #include <asm/mach-types.h> + #include <asm/mach/arch.h> + #include <asm/mach/time.h> + ++#include <mach/gmac.h> + + #include "common.h" + ++static struct mdio_gpio_platform_data wbd222_mdio = { ++ .mdc = 22, ++ .mdio = 21, ++ .phy_mask = ~((1 << 1) | (1 << 3)), ++}; ++ ++static struct platform_device wbd222_phy_device = { ++ .name = "mdio-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &wbd222_mdio, ++ }, ++}; ++ ++static struct gemini_gmac_platform_data gmac_data = { ++ .bus_id[0] = "gpio-0:01", ++ .interface[0] = PHY_INTERFACE_MODE_MII, ++ .bus_id[1] = "gpio-0:03", ++ .interface[1] = PHY_INTERFACE_MODE_MII, ++}; ++ + static struct gpio_keys_button wbd222_keys[] = { + { + .code = KEY_SETUP, +@@ -122,6 +145,8 @@ static void __init wbd222_init(void) + platform_device_register(&wbd222_keys_device); + platform_register_rtc(); + platform_register_watchdog(); ++ platform_device_register(&wbd222_phy_device); ++ platform_register_ethernet(&gmac_data); + } + + MACHINE_START(WBD222, "Wiliboard WBD-222") +--- a/arch/arm/mach-gemini/board-rut1xx.c ++++ b/arch/arm/mach-gemini/board-rut1xx.c +@@ -15,13 +15,35 @@ + #include <linux/input.h> + #include <linux/gpio_keys.h> + #include <linux/sizes.h> ++#include <linux/platform_data/mdio-gpio.h> + + #include <asm/mach-types.h> + #include <asm/mach/arch.h> + #include <asm/mach/time.h> + ++#include <mach/gmac.h> ++ + #include "common.h" + ++static struct mdio_gpio_platform_data rut1xx_mdio = { ++ .mdc = 22, ++ .mdio = 21, ++ .phy_mask = ~(1 << 1), ++}; ++ ++static struct platform_device rut1xx_phy_device = { ++ .name = "mdio-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &rut1xx_mdio, ++ }, ++}; ++ ++static struct gemini_gmac_platform_data gmac_data = { ++ .bus_id[0] = "gpio-0:01", ++ .interface[0] = PHY_INTERFACE_MODE_MII, ++}; ++ + static struct gpio_keys_button rut1xx_keys[] = { + { + .code = KEY_SETUP, +@@ -81,6 +103,8 @@ static void __init rut1xx_init(void) + platform_device_register(&rut1xx_keys_device); + platform_register_rtc(); + platform_register_watchdog(); ++ platform_device_register(&rut1xx_phy_device); ++ platform_register_ethernet(&gmac_data); + } + + MACHINE_START(RUT100, "Teltonika RUT100") diff --git a/target/linux/gemini/patches/130-usb-ehci-add-fot2g-driver.patch b/target/linux/gemini/patches/130-usb-ehci-add-fot2g-driver.patch new file mode 100644 index 0000000..2192ad6 --- /dev/null +++ b/target/linux/gemini/patches/130-usb-ehci-add-fot2g-driver.patch @@ -0,0 +1,133 @@ +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -352,11 +352,13 @@ static void ehci_silence_controller(stru + ehci->rh_state = EHCI_RH_HALTED; + ehci_turn_off_all_ports(ehci); + ++#ifndef CONFIG_ARCH_GEMINI + /* make BIOS/etc use companion controller during reboot */ + ehci_writel(ehci, 0, &ehci->regs->configured_flag); + + /* unblock posted writes */ + ehci_readl(ehci, &ehci->regs->configured_flag); ++#endif + spin_unlock_irq(&ehci->lock); + } + +@@ -608,7 +610,9 @@ static int ehci_run (struct usb_hcd *hcd + // Philips, Intel, and maybe others need CMD_RUN before the + // root hub will detect new devices (why?); NEC doesn't + ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); ++#ifndef CONFIG_ARCH_GEMINI + ehci->command |= CMD_RUN; ++#endif + ehci_writel(ehci, ehci->command, &ehci->regs->command); + dbg_cmd (ehci, "init", ehci->command); + +@@ -628,9 +632,11 @@ static int ehci_run (struct usb_hcd *hcd + */ + down_write(&ehci_cf_port_reset_rwsem); + ehci->rh_state = EHCI_RH_RUNNING; ++#ifndef CONFIG_ARCH_GEMINI + ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); + ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ + msleep(5); ++#endif + up_write(&ehci_cf_port_reset_rwsem); + ehci->last_periodic_enable = ktime_get_real(); + +@@ -768,9 +774,10 @@ static irqreturn_t ehci_irq (struct usb_ + pcd_status = status; + + /* resume root hub? */ ++#ifndef CONFIG_ARCH_GEMINI + if (ehci->rh_state == EHCI_RH_SUSPENDED) + usb_hcd_resume_root_hub(hcd); +- ++#endif + /* get per-port change detect bits */ + if (ehci->has_ppcd) + ppcd = status >> 16; +@@ -1296,6 +1303,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER ehci_hcd_sead3_driver + #endif + ++#ifdef CONFIG_ARCH_GEMINI ++#include "ehci-fotg2.c" ++#define PLATFORM_DRIVER ehci_fotg2_driver ++#endif ++ + static int __init ehci_hcd_init(void) + { + int retval = 0; +--- a/drivers/usb/host/ehci-timer.c ++++ b/drivers/usb/host/ehci-timer.c +@@ -208,7 +208,9 @@ static void ehci_handle_controller_death + + /* Clean up the mess */ + ehci->rh_state = EHCI_RH_HALTED; ++#ifndef CONFIG_ARCH_GEMINI + ehci_writel(ehci, 0, &ehci->regs->configured_flag); ++#endif + ehci_writel(ehci, 0, &ehci->regs->intr_enable); + ehci_work(ehci); + end_unlink_async(ehci); +--- a/drivers/usb/host/ehci.h ++++ b/drivers/usb/host/ehci.h +@@ -657,7 +657,12 @@ static inline unsigned int + ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc) + { + if (ehci_is_TDI(ehci)) { +- switch ((portsc >> (ehci->has_hostpc ? 25 : 26)) & 3) { ++#ifdef CONFIG_ARCH_GEMINI ++ portsc = readl(ehci_to_hcd(ehci)->regs + 0x80); ++ switch ((portsc>>22)&3) { ++#else ++ switch ((portsc>>26)&3) { ++#endif + case 0: + return 0; + case 1: +--- a/drivers/usb/host/ehci-hub.c ++++ b/drivers/usb/host/ehci-hub.c +@@ -1076,6 +1076,11 @@ int ehci_hub_control( + /* see what we found out */ + temp = check_reset_complete (ehci, wIndex, status_reg, + ehci_readl(ehci, status_reg)); ++#ifdef CONFIG_ARCH_GEMINI ++ /* restart schedule */ ++ ehci->command |= CMD_RUN; ++ ehci_writel(ehci, ehci->command, &ehci->regs->command); ++#endif + } + + /* transfer dedicated ports to the companion hc */ +--- a/include/linux/usb/ehci_def.h ++++ b/include/linux/usb/ehci_def.h +@@ -112,8 +112,13 @@ struct ehci_regs { + u32 frame_list; /* points to periodic list */ + /* ASYNCLISTADDR: offset 0x18 */ + u32 async_next; /* address of next async queue head */ +- ++#ifndef CONFIG_ARCH_GEMINI + u32 reserved1[2]; ++#else ++ u32 reserved1; ++ /* PORTSC: offset 0x20 for Faraday OTG */ ++ u32 port_status[1]; ++#endif + + /* TXFILLTUNING: offset 0x24 */ + u32 txfill_tuning; /* TX FIFO Tuning register */ +@@ -125,8 +130,11 @@ struct ehci_regs { + u32 configured_flag; + #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ + ++#ifndef CONFIG_ARCH_GEMINI + /* PORTSC: offset 0x44 */ + u32 port_status[0]; /* up to N_PORTS */ ++#endif ++ + /* EHCI 1.1 addendum */ + #define PORTSC_SUSPEND_STS_ACK 0 + #define PORTSC_SUSPEND_STS_NYET 1 diff --git a/target/linux/gemini/patches/131-arm-gemini-add-usb-device.patch b/target/linux/gemini/patches/131-arm-gemini-add-usb-device.patch new file mode 100644 index 0000000..a75a5c1 --- /dev/null +++ b/target/linux/gemini/patches/131-arm-gemini-add-usb-device.patch @@ -0,0 +1,77 @@ +--- a/arch/arm/mach-gemini/devices.c ++++ b/arch/arm/mach-gemini/devices.c +@@ -187,3 +187,64 @@ int platform_register_ethernet(struct ge + + return platform_device_register(ðernet_device); + } ++ ++static struct resource usb0_resources[] = { ++ { ++ .start = GEMINI_USB0_BASE, ++ .end = GEMINI_USB0_BASE + 0xfff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IRQ_USB0, ++ .end = IRQ_USB0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct resource usb1_resources[] = { ++ { ++ .start = GEMINI_USB1_BASE, ++ .end = GEMINI_USB1_BASE + 0xfff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IRQ_USB1, ++ .end = IRQ_USB1, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 usb0_dmamask = 0xffffffffUL; ++static u64 usb1_dmamask = 0xffffffffUL; ++ ++static struct platform_device usb_device[] = { ++ { ++ .name = "ehci-fotg2", ++ .id = 0, ++ .dev = { ++ .dma_mask = &usb0_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++ .num_resources = ARRAY_SIZE(usb0_resources), ++ .resource = usb0_resources, ++ }, ++ { ++ .name = "ehci-fotg2", ++ .id = 1, ++ .dev = { ++ .dma_mask = &usb1_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++ .num_resources = ARRAY_SIZE(usb1_resources), ++ .resource = usb1_resources, ++ }, ++}; ++ ++int __init platform_register_usb(unsigned int id) ++{ ++ if (id > 1) ++ return -EINVAL; ++ ++ return platform_device_register(&usb_device[id]); ++} ++ +--- a/arch/arm/mach-gemini/common.h ++++ b/arch/arm/mach-gemini/common.h +@@ -30,6 +30,7 @@ extern int platform_register_pflash(unsi + unsigned int nr_parts); + extern int platform_register_watchdog(void); + extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata); ++extern int platform_register_usb(unsigned int id); + + extern void gemini_restart(enum reboot_mode mode, const char *cmd); + diff --git a/target/linux/gemini/patches/132-arm-gemini-register-usb.patch b/target/linux/gemini/patches/132-arm-gemini-register-usb.patch new file mode 100644 index 0000000..2a61d82 --- /dev/null +++ b/target/linux/gemini/patches/132-arm-gemini-register-usb.patch @@ -0,0 +1,65 @@ +--- a/arch/arm/mach-gemini/board-wbd111.c ++++ b/arch/arm/mach-gemini/board-wbd111.c +@@ -145,6 +145,7 @@ static void __init wbd111_init(void) + platform_register_watchdog(); + platform_device_register(&wbd111_phy_device); + platform_register_ethernet(&gmac_data); ++ platform_register_usb(0); + } + + MACHINE_START(WBD111, "Wiliboard WBD-111") +--- a/arch/arm/mach-gemini/board-wbd222.c ++++ b/arch/arm/mach-gemini/board-wbd222.c +@@ -147,6 +147,7 @@ static void __init wbd222_init(void) + platform_register_watchdog(); + platform_device_register(&wbd222_phy_device); + platform_register_ethernet(&gmac_data); ++ platform_register_usb(0); + } + + MACHINE_START(WBD222, "Wiliboard WBD-222") +--- a/arch/arm/mach-gemini/board-rut1xx.c ++++ b/arch/arm/mach-gemini/board-rut1xx.c +@@ -105,6 +105,7 @@ static void __init rut1xx_init(void) + platform_register_watchdog(); + platform_device_register(&rut1xx_phy_device); + platform_register_ethernet(&gmac_data); ++ platform_register_usb(0); + } + + MACHINE_START(RUT100, "Teltonika RUT100") +--- a/arch/arm/mach-gemini/board-nas4220b.c ++++ b/arch/arm/mach-gemini/board-nas4220b.c +@@ -134,10 +134,23 @@ static void __init ib4220b_gmac_init(voi + GLOBAL_ARBITRATION1_CTRL)); + } + ++static void __init usb_ib4220b_init(void) ++{ ++ unsigned int val; ++ ++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++ val &= ~(USB0_PLUG_MINIB | USB1_PLUG_MINIB); ++ val |= USB0_VBUS_ON | USB1_VBUS_ON; ++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++} ++ + static void __init ib4220b_init(void) + { + gemini_gpio_init(); + ib4220b_gmac_init(); ++ usb_ib4220b_init(); + platform_register_uart(); + platform_register_pflash(SZ_16M, NULL, 0); + platform_device_register(&ib4220b_led_device); +@@ -146,6 +159,8 @@ static void __init ib4220b_init(void) + platform_register_watchdog(); + platform_device_register(&ib4220b_phy_device); + platform_register_ethernet(&ib4220b_gmac_data); ++ platform_register_usb(0); ++ platform_register_usb(1); + } + + MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") diff --git a/target/linux/gemini/patches/140-arm-gemini-add-pci-support.patch b/target/linux/gemini/patches/140-arm-gemini-add-pci-support.patch new file mode 100644 index 0000000..d17b1a1 --- /dev/null +++ b/target/linux/gemini/patches/140-arm-gemini-add-pci-support.patch @@ -0,0 +1,66 @@ +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -399,6 +399,7 @@ config ARCH_GEMINI + select CLKSRC_MMIO + select CPU_FA526 + select GENERIC_CLOCKEVENTS ++ select MIGHT_HAVE_PCI + help + Support for the Cortina Systems Gemini family SoCs + +--- a/arch/arm/mach-gemini/include/mach/hardware.h ++++ b/arch/arm/mach-gemini/include/mach/hardware.h +@@ -68,4 +68,9 @@ + */ + #define IO_ADDRESS(x) IOMEM((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000) + ++/* ++ * PCI subsystem macros ++ */ ++#define pcibios_assign_all_busses() 1 ++ + #endif +--- a/arch/arm/mach-gemini/include/mach/irqs.h ++++ b/arch/arm/mach-gemini/include/mach/irqs.h +@@ -43,11 +43,14 @@ + + #define NORMAL_IRQ_NUM 32 + +-#define GPIO_IRQ_BASE NORMAL_IRQ_NUM ++#define PCI_IRQ_BASE NORMAL_IRQ_NUM ++#define PCI_IRQ_NUM 4 ++ ++#define GPIO_IRQ_BASE (NORMAL_IRQ_NUM + PCI_IRQ_NUM) + #define GPIO_IRQ_NUM (3 * 32) + + #define ARCH_TIMER_IRQ IRQ_TIMER2 + +-#define NR_IRQS (NORMAL_IRQ_NUM + GPIO_IRQ_NUM) ++#define NR_IRQS (NORMAL_IRQ_NUM + PCI_IRQ_NUM + GPIO_IRQ_NUM) + + #endif /* __MACH_IRQS_H__ */ +--- a/arch/arm/mach-gemini/Makefile ++++ b/arch/arm/mach-gemini/Makefile +@@ -6,6 +6,8 @@ + + obj-y := irq.o mm.o time.o devices.o gpio.o idle.o reset.o + ++obj-$(CONFIG_PCI) += pci.o ++ + # Board-specific support + obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o + obj-$(CONFIG_MACH_RUT100) += board-rut1xx.o +--- a/arch/arm/mach-gemini/mm.c ++++ b/arch/arm/mach-gemini/mm.c +@@ -59,6 +59,11 @@ static struct map_desc gemini_io_desc[] + .length = SZ_512K, + .type = MT_DEVICE, + }, { ++ .virtual = (unsigned long)IO_ADDRESS(GEMINI_PCI_IO_BASE), ++ .pfn = __phys_to_pfn(GEMINI_PCI_IO_BASE), ++ .length = SZ_512K, ++ .type = MT_DEVICE, ++ }, { + .virtual = (unsigned long)IO_ADDRESS(GEMINI_FLASH_CTRL_BASE), + .pfn = __phys_to_pfn(GEMINI_FLASH_CTRL_BASE), + .length = SZ_512K, diff --git a/target/linux/gemini/patches/150-gemini-pata.patch b/target/linux/gemini/patches/150-gemini-pata.patch new file mode 100644 index 0000000..3da05c5 --- /dev/null +++ b/target/linux/gemini/patches/150-gemini-pata.patch @@ -0,0 +1,192 @@ +--- a/arch/arm/mach-gemini/include/mach/global_reg.h ++++ b/arch/arm/mach-gemini/include/mach/global_reg.h +@@ -227,7 +227,13 @@ + #define USB0_PLUG_MINIB (1 << 29) + #define GMAC_GMII (1 << 28) + #define GMAC_1_ENABLE (1 << 27) +-/* TODO: define ATA/SATA bits */ ++/* 011 - ata0 <-> sata0, sata1; bring out ata1 ++ * 010 - ata1 <-> sata1, sata0; bring out ata0 ++ * 001 - ata0 <-> sata0, ata1 <-> sata1; bring out ata1 ++ * 000 - ata0 <-> sata0, ata1 <-> sata1; bring out ata0 */ ++#define IDE_IOMUX_MASK (7 << 24) ++#define IDE_IOMUX_SATA1_SATA0 (2 << 24) ++#define IDE_IOMUX_SATA0_SATA1 (3 << 24) + #define USB1_VBUS_ON (1 << 23) + #define USB0_VBUS_ON (1 << 22) + #define APB_CLKOUT_ENABLE (1 << 21) +--- a/arch/arm/mach-gemini/irq.c ++++ b/arch/arm/mach-gemini/irq.c +@@ -89,6 +89,9 @@ void __init gemini_init_irq(void) + irq_set_handler(i, handle_edge_irq); + mode |= 1 << i; + level |= 1 << i; ++ } else if (i >= IRQ_IDE0 && i <= IRQ_IDE1) { ++ irq_set_handler(i, handle_edge_irq); ++ mode |= 1 << i; + } else { + irq_set_handler(i, handle_level_irq); + } +--- a/arch/arm/mach-gemini/common.h ++++ b/arch/arm/mach-gemini/common.h +@@ -31,6 +31,7 @@ extern int platform_register_pflash(unsi + extern int platform_register_watchdog(void); + extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata); + extern int platform_register_usb(unsigned int id); ++extern int platform_register_pata(unsigned int id); + + extern void gemini_restart(enum reboot_mode mode, const char *cmd); + +--- a/arch/arm/mach-gemini/devices.c ++++ b/arch/arm/mach-gemini/devices.c +@@ -248,3 +248,67 @@ int __init platform_register_usb(unsigne + return platform_device_register(&usb_device[id]); + } + ++static u64 pata_gemini_dmamask0 = 0xffffffffUL; ++static u64 pata_gemini_dmamask1 = 0xffffffffUL; ++ ++static struct resource pata_gemini_resources0[] = ++{ ++ [0] = { ++ .start = GEMINI_IDE0_BASE, ++ .end = GEMINI_IDE0_BASE + 0x40, ++ .flags = IORESOURCE_MEM, ++ }, ++ [1] = { ++ .start = IRQ_IDE0, ++ .end = IRQ_IDE0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct resource pata_gemini_resources1[] = ++{ ++ [0] = { ++ .start = GEMINI_IDE1_BASE, ++ .end = GEMINI_IDE1_BASE + 0x40, ++ .flags = IORESOURCE_MEM, ++ }, ++ [1] = { ++ .start = IRQ_IDE1, ++ .end = IRQ_IDE1, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct platform_device pata_gemini_devices[] = ++{ ++ { ++ .name = "pata-gemini", ++ .id = 0, ++ .dev = ++ { ++ .dma_mask = &pata_gemini_dmamask0, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++ .num_resources = ARRAY_SIZE(pata_gemini_resources0), ++ .resource = pata_gemini_resources0, ++ }, ++ { ++ .name = "pata-gemini", ++ .id = 1, ++ .dev = ++ { ++ .dma_mask = &pata_gemini_dmamask1, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++ .num_resources = ARRAY_SIZE(pata_gemini_resources1), ++ .resource = pata_gemini_resources1, ++ }, ++}; ++ ++int __init platform_register_pata(unsigned int id) ++{ ++ if (id > 1) ++ return -EINVAL; ++ ++ return platform_device_register(&pata_gemini_devices[id]); ++} +--- a/arch/arm/mach-gemini/mm.c ++++ b/arch/arm/mach-gemini/mm.c +@@ -24,6 +24,11 @@ static struct map_desc gemini_io_desc[] + .length = SZ_512K, + .type = MT_DEVICE, + }, { ++ .virtual = (unsigned long)IO_ADDRESS(GEMINI_SATA_BASE), ++ .pfn = __phys_to_pfn(GEMINI_SATA_BASE), ++ .length = SZ_512K, ++ .type = MT_DEVICE, ++ }, { + .virtual = (unsigned long)IO_ADDRESS(GEMINI_UART_BASE), + .pfn = __phys_to_pfn(GEMINI_UART_BASE), + .length = SZ_512K, +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -564,6 +564,16 @@ config PATA_EP93XX + + If unsure, say N. + ++config PATA_GEMINI ++ tristate "Gemini PATA support (Experimental)" ++ depends on ARCH_GEMINI ++ help ++ This option enables support for the Gemini PATA-Controller. ++ Note that the Gemini SoC has no native SATA-Controller but an ++ onboard PATA-SATA bridge. ++ ++ If unsure, say N. ++ + config PATA_HPT366 + tristate "HPT 366/368 PATA support" + depends on PCI +--- a/drivers/ata/Makefile ++++ b/drivers/ata/Makefile +@@ -56,6 +56,7 @@ obj-$(CONFIG_PATA_CS5536) += pata_cs5536 + obj-$(CONFIG_PATA_CYPRESS) += pata_cypress.o + obj-$(CONFIG_PATA_EFAR) += pata_efar.o + obj-$(CONFIG_PATA_EP93XX) += pata_ep93xx.o ++obj-$(CONFIG_PATA_GEMINI) += pata_gemini.o + obj-$(CONFIG_PATA_HPT366) += pata_hpt366.o + obj-$(CONFIG_PATA_HPT37X) += pata_hpt37x.o + obj-$(CONFIG_PATA_HPT3X2N) += pata_hpt3x2n.o +--- a/arch/arm/mach-gemini/board-nas4220b.c ++++ b/arch/arm/mach-gemini/board-nas4220b.c +@@ -146,11 +146,28 @@ static void __init usb_ib4220b_init(void + GLOBAL_MISC_CTRL)); + } + ++static void __init sata_ib4220b_init(void) ++{ ++ unsigned val; ++ ++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++ val &= ~(IDE_IOMUX_MASK | PFLASH_PADS_DISABLE); ++ val |= IDE_PADS_ENABLE; ++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) + ++ GLOBAL_MISC_CTRL)); ++ ++ /* enabling ports for presence detection, master only */ ++ writel(0x00000001, (void __iomem*)(IO_ADDRESS(GEMINI_SATA_BASE) + 0x18)); ++ writel(0x00000001, (void __iomem*)(IO_ADDRESS(GEMINI_SATA_BASE) + 0x1c)); ++} ++ + static void __init ib4220b_init(void) + { + gemini_gpio_init(); + ib4220b_gmac_init(); + usb_ib4220b_init(); ++ sata_ib4220b_init(); + platform_register_uart(); + platform_register_pflash(SZ_16M, NULL, 0); + platform_device_register(&ib4220b_led_device); +@@ -161,6 +178,8 @@ static void __init ib4220b_init(void) + platform_register_ethernet(&ib4220b_gmac_data); + platform_register_usb(0); + platform_register_usb(1); ++ platform_register_pata(0); ++ platform_register_pata(1); + } + + MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") |