From ed0e649a5b0b4664eeb85a6137542ec4c0de7513 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 8 Jun 2011 17:57:55 +0000 Subject: * fixes spi flash for ar9 * adds limited support for netgear dgn3500 (enough for others to start working with) SVN-Revision: 27137 --- target/linux/atheros/config-2.6.37 | 73 ++++---------- target/linux/lantiq/image/Makefile | 10 ++ target/linux/lantiq/patches-2.6.39/410-spi2.patch | 11 +- target/linux/lantiq/patches-2.6.39/420-spi3.patch | 26 ++++- .../linux/lantiq/patches-2.6.39/999-dgn3500.patch | 111 +++++++++++++++++++++ target/linux/lantiq/xway/config-default | 3 +- target/linux/lantiq/xway/profiles/003-netgear.mk | 11 ++ 7 files changed, 184 insertions(+), 61 deletions(-) create mode 100644 target/linux/lantiq/patches-2.6.39/999-dgn3500.patch create mode 100644 target/linux/lantiq/xway/profiles/003-netgear.mk diff --git a/target/linux/atheros/config-2.6.37 b/target/linux/atheros/config-2.6.37 index 739efc7b16..e5d8552ead 100644 --- a/target/linux/atheros/config-2.6.37 +++ b/target/linux/atheros/config-2.6.37 @@ -1,13 +1,11 @@ -CONFIG_32BIT=y -# CONFIG_ALCHEMY_GPIO_INDIRECT is not set CONFIG_AR231X_ETHERNET=y -# CONFIG_AR7 is not set CONFIG_AR8216_PHY=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_HIBERNATION_POSSIBLE=y # CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y @@ -16,13 +14,8 @@ CONFIG_ATHEROS_AR2315_PCI=y CONFIG_ATHEROS_AR231X=y CONFIG_ATHEROS_AR5312=y CONFIG_ATHEROS_WDT=y -# CONFIG_BCM47XX is not set -# CONFIG_BCM63XX is not set -CONFIG_BITREVERSE=y +# CONFIG_AUTO_IRQ_AFFINITY is not set # CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_CAVIUM_OCTEON_HELPER=y -# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set -# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y @@ -40,8 +33,6 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y CONFIG_DECOMPRESS_LZMA=y -CONFIG_DEVPORT=y -# CONFIG_DM9000 is not set CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y # CONFIG_FSNOTIFY is not set @@ -52,50 +43,47 @@ CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y +# CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED is not set CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +# CONFIG_GENERIC_PENDING_IRQ is not set +CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y +CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set -# CONFIG_HARDLOCKUP_DETECTOR is not set +# CONFIG_HARDIRQS_SW_RESEND is not set CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT=y CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_GENERIC_HARDIRQS=y CONFIG_HAVE_IDE=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +# CONFIG_HAVE_SPARSE_IRQ is not set CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_IP17XX_PHY=y CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" +CONFIG_IP17XX_PHY=y CONFIG_IRQ_CPU=y +# CONFIG_IRQ_PER_CPU is not set # CONFIG_LEDS_GPIO is not set -# CONFIG_LOONGSON_MC146818 is not set CONFIG_LOONGSON_UART_BASE=y -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MIKROTIK_RB532 is not set +CONFIG_MACH_NO_WESTBRIDGE=y CONFIG_MIPS=y -# CONFIG_MIPS_ALCHEMY is not set -# CONFIG_MIPS_COBALT is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MALTA is not set CONFIG_MIPS_MT_DISABLED=y -# CONFIG_MIPS_SIM is not set CONFIG_MTD_AR2315=y CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set @@ -106,39 +94,19 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MVSWITCH_PHY=y CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y # CONFIG_NET_PCI is not set -# CONFIG_NO_IOPORT is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y CONFIG_PHYLIB=y -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -# CONFIG_POWERTV is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_QUOTACTL is not set # CONFIG_SCSI_DMA is not set -CONFIG_SCSI_MOD=y -# CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_NR_UARTS=1 CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -# CONFIG_SERIAL_MFD_HSU is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set # CONFIG_SWAP is not set CONFIG_SWCONFIG=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y @@ -146,6 +114,5 @@ CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index e73ee1936d..0e62ce5660 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -136,6 +136,14 @@ define Image/Build/Profile/ARV752DPW22 $(call Image/Build/$(1),$(1),ARV752DPW22) endef +define Image/BuildKernel/Profile/DGN3500B + $(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline)) +endef + +define Image/Build/Profile/DGN3500B + $(call Image/Build/$(1),$(1),DGN3500B) +endef + define Image/BuildKernel/Profile/Generic $(call Image/BuildKernel/Template,EASY4010,$(xway_cmdline)) $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline)) @@ -149,6 +157,7 @@ define Image/BuildKernel/Profile/Generic $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline)) $(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline)) $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline)) + $(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline)) $(call Image/BuildKernel/Template,NONE) endef @@ -165,6 +174,7 @@ define Image/Build/Profile/Generic $(call Image/Build/$(1),$(1),ARV7518PW) $(call Image/Build/$(1),$(1),ARV752DPW) $(call Image/Build/$(1),$(1),ARV752DPW22) + $(call Image/Build/$(1),$(1),DGN3500B) $(call Image/Build/$(1),$(1),NONE) $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs endef diff --git a/target/linux/lantiq/patches-2.6.39/410-spi2.patch b/target/linux/lantiq/patches-2.6.39/410-spi2.patch index e37790a81e..ee07188ed2 100644 --- a/target/linux/lantiq/patches-2.6.39/410-spi2.patch +++ b/target/linux/lantiq/patches-2.6.39/410-spi2.patch @@ -10,13 +10,13 @@ Signed-off-by: Daniel Schwierzeck --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig -@@ -193,6 +193,14 @@ config SPI_IMX +@@ -193,6 +193,14 @@ This enables using the Freescale i.MX SPI controllers in master mode. +config SPI_LANTIQ + tristate "Lantiq SoC SPI controller" -+ depends on SOC_LANTIQ_XWAY ++ depends on SOC_TYPE_XWAY + select SPI_BITBANG + help + This driver supports the Lantiq SoC SPI controller in master @@ -27,7 +27,7 @@ Signed-off-by: Daniel Schwierzeck depends on PARPORT && EXPERIMENTAL --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile -@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_EP93XX) += ep93xx_spi. +@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_GPIO) += spi_gpio.o obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o obj-$(CONFIG_SPI_IMX) += spi_imx.o @@ -37,7 +37,7 @@ Signed-off-by: Daniel Schwierzeck obj-$(CONFIG_SPI_PXA2XX_PCI) += pxa2xx_spi_pci.o --- /dev/null +++ b/drivers/spi/spi_lantiq.c -@@ -0,0 +1,1063 @@ +@@ -0,0 +1,1062 @@ +/* + * Lantiq SoC SPI controller + * @@ -64,8 +64,7 @@ Signed-off-by: Daniel Schwierzeck +#include +#include + -+#include -+#include ++#include +#include + +#define LTQ_SPI_CLC 0x00 /* Clock control */ diff --git a/target/linux/lantiq/patches-2.6.39/420-spi3.patch b/target/linux/lantiq/patches-2.6.39/420-spi3.patch index f89886fb75..a0e517a7c9 100644 --- a/target/linux/lantiq/patches-2.6.39/420-spi3.patch +++ b/target/linux/lantiq/patches-2.6.39/420-spi3.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Schwierzeck #include #include -@@ -119,3 +120,28 @@ ltq_register_etop(struct ltq_eth_data *e +@@ -119,3 +120,41 @@ platform_device_register(<q_etop); } } @@ -34,6 +34,17 @@ Signed-off-by: Daniel Schwierzeck + IRQ_RES(spi_err, LTQ_SSC_EIR), +}; + ++static struct resource ltq_spi_resources_ar9[] = { ++ { ++ .start = LTQ_SSC_BASE_ADDR, ++ .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, ++ .flags = IORESOURCE_MEM, ++ }, ++ IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9), ++ IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9), ++ IRQ_RES(spi_err, LTQ_SSC_EIR), ++}; ++ +static struct platform_device ltq_spi = { + .name = "ltq-spi", + .resource = ltq_spi_resources, @@ -43,7 +54,20 @@ Signed-off-by: Daniel Schwierzeck +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata, + struct spi_board_info const *info, unsigned n) +{ ++ if(ltq_is_ar9()) ++ ltq_spi.resource = ltq_spi_resources_ar9; + spi_register_board_info(info, n); + ltq_spi.dev.platform_data = pdata; + platform_device_register(<q_spi); +} +--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h ++++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h +@@ -27,6 +27,8 @@ + + #define LTQ_SSC_TIR (INT_NUM_IM0_IRL0 + 15) + #define LTQ_SSC_RIR (INT_NUM_IM0_IRL0 + 14) ++#define LTQ_SSC_TIR_AR9 (INT_NUM_IM0_IRL0 + 14) ++#define LTQ_SSC_RIR_AR9 (INT_NUM_IM0_IRL0 + 15) + #define LTQ_SSC_EIR (INT_NUM_IM0_IRL0 + 16) + + #define LTQ_MEI_DYING_GASP_INT (INT_NUM_IM1_IRL0 + 21) diff --git a/target/linux/lantiq/patches-2.6.39/999-dgn3500.patch b/target/linux/lantiq/patches-2.6.39/999-dgn3500.patch new file mode 100644 index 0000000000..aa8db1008e --- /dev/null +++ b/target/linux/lantiq/patches-2.6.39/999-dgn3500.patch @@ -0,0 +1,111 @@ +--- a/arch/mips/lantiq/machtypes.h ++++ b/arch/mips/lantiq/machtypes.h +@@ -32,6 +32,9 @@ + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */ + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */ + LANTIQ_MACH_ARV7518PW, /* ASTORIA */ ++ ++ /* Netgear */ ++ LANTIQ_MACH_DGN3500B, /* Netgear DGN3500 */ + }; + + #endif +--- a/arch/mips/lantiq/xway/Kconfig ++++ b/arch/mips/lantiq/xway/Kconfig +@@ -10,6 +10,10 @@ + bool "ARV45XX" + default y + ++config LANTIQ_MACH_NETGEAR ++ bool "Netgear" ++ default y ++ + endmenu + + endif +--- a/arch/mips/lantiq/xway/Makefile ++++ b/arch/mips/lantiq/xway/Makefile +@@ -6,4 +6,5 @@ + obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o + obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o + obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o ++obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o + obj-y += dev-dwc_otg.o +--- a/arch/mips/lantiq/xway/devices.h ++++ b/arch/mips/lantiq/xway/devices.h +@@ -12,6 +12,7 @@ + #include "../devices.h" + #include + #include ++#include + + extern void ltq_register_gpio(void); + extern void ltq_register_gpio_stp(void); +@@ -20,5 +21,7 @@ + extern void ltq_register_gpio_ebu(unsigned int value); + extern void ltq_register_madwifi_eep(void); + extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt); ++extern void ltq_register_spi(struct ltq_spi_platform_data *pdata, ++ struct spi_board_info const *info, unsigned n); + + #endif +--- /dev/null ++++ b/arch/mips/lantiq/xway/mach-netgear.c +@@ -0,0 +1,57 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ * Copyright (C) 2010 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "../machtypes.h" ++#include "devices.h" ++ ++static struct ltq_pci_data ltq_pci_data = { ++ .clock = PCI_CLOCK_INT, ++ .gpio = PCI_GNT1 | PCI_REQ1, ++ .irq = { ++ [14] = INT_NUM_IM0_IRL0 + 22, ++ }, ++}; ++ ++static struct ltq_eth_data ltq_eth_data = { ++ .mii_mode = PHY_INTERFACE_MODE_MII, ++}; ++ ++struct spi_board_info spi_info = { ++ .bus_num = 0, ++ .chip_select = 3, ++ .max_speed_hz = 25000000, ++ .modalias = "mx25l12805d", ++}; ++ ++struct ltq_spi_platform_data ltq_spi_data = { ++ .num_chipselect = 4, ++}; ++ ++static void __init dgn3500_init(void) ++{ ++ ltq_register_pci(<q_pci_data); ++ ltq_register_etop(<q_eth_data); ++ ltq_register_spi(<q_spi_data, &spi_info, 1); ++} ++ ++MIPS_MACHINE(LANTIQ_MACH_DGN3500B, ++ "DGN3500B", ++ "Netgear DGN3500B", ++ dgn3500_init); diff --git a/target/linux/lantiq/xway/config-default b/target/linux/lantiq/xway/config-default index dd59fa68d2..5ef2fb3463 100644 --- a/target/linux/lantiq/xway/config-default +++ b/target/linux/lantiq/xway/config-default @@ -26,9 +26,9 @@ CONFIG_INPUT_POLLDEV=y CONFIG_LANTIQ_ETOP=y CONFIG_LANTIQ_MACH_ARV45XX=y CONFIG_LANTIQ_MACH_EASY50712=y +CONFIG_LANTIQ_MACH_NETGEAR=y CONFIG_MACH_NO_WESTBRIDGE=y # CONFIG_MINIX_FS_NATIVE_ENDIAN is not set -# CONFIG_MTD_LATCH_ADDR is not set CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_PCI=y @@ -44,6 +44,7 @@ CONFIG_SOC_XWAY=y CONFIG_SPI=y CONFIG_SPI_BITBANG=y # CONFIG_SPI_GPIO is not set +CONFIG_SPI_LANTIQ=y CONFIG_SPI_MASTER=y CONFIG_USB_SUPPORT=y CONFIG_XZ_DEC=y diff --git a/target/linux/lantiq/xway/profiles/003-netgear.mk b/target/linux/lantiq/xway/profiles/003-netgear.mk new file mode 100644 index 0000000000..51a98bb2d4 --- /dev/null +++ b/target/linux/lantiq/xway/profiles/003-netgear.mk @@ -0,0 +1,11 @@ +define Profile/DGN3500B + NAME:=DGN3500B + PACKAGES:= kmod-usb-core kmod-usb-dwc-otg kmod-leds-gpio +endef + +define Profile/DGN3500B/Description + Netgear DGN3500B +endef + +$(eval $(call Profile,DGN3500B)) + -- cgit v1.2.3