From ba05c97e5e3ee3b0dd31b724c9053c06de99de34 Mon Sep 17 00:00:00 2001 From: Zoltan Herpai Date: Mon, 6 Jan 2014 21:51:39 +0000 Subject: [PATCH] sunxi: various fixes - DT: update USB vbus from 3.3v to 5v - emac: add missing free_irq - DT: add emac aliases - DT: fix interrupts on A20 - modules: add watchdog module - don't compile in mac80211 - don't compile in usbnet Thanks to Hans de Goede, Zalan Blenessy et al. Signed-off-by: Zoltan HERPAI SVN-Revision: 39204 --- target/linux/sunxi/config-3.12 | 22 +-- target/linux/sunxi/modules.mk | 15 ++ .../165-dt-usb-update-vbus-voltage.patch | 109 +++++++++++ .../200-emac-add-missing-free_irq.patch | 46 +++++ .../201-dt-add-emac-aliases.patch | 70 +++++++ .../patches-3.12/210-fix-a20-irqtypes.patch | 179 ++++++++++++++++++ 6 files changed, 420 insertions(+), 21 deletions(-) create mode 100644 target/linux/sunxi/patches-3.12/165-dt-usb-update-vbus-voltage.patch create mode 100644 target/linux/sunxi/patches-3.12/200-emac-add-missing-free_irq.patch create mode 100644 target/linux/sunxi/patches-3.12/201-dt-add-emac-aliases.patch create mode 100644 target/linux/sunxi/patches-3.12/210-fix-a20-irqtypes.patch diff --git a/target/linux/sunxi/config-3.12 b/target/linux/sunxi/config-3.12 index 6d97ba0f41e..3a590827175 100644 --- a/target/linux/sunxi/config-3.12 +++ b/target/linux/sunxi/config-3.12 @@ -53,13 +53,6 @@ CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_BOUNCE=y CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_CACHE_L2X0 is not set -CONFIG_CFG80211=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_WEXT is not set CONFIG_CFQ_GROUP_IOSCHED=y CONFIG_CGROUPS=y CONFIG_CGROUP_CPUACCT=y @@ -250,17 +243,6 @@ CONFIG_LEGACY_PTY_COUNT=256 CONFIG_LOG_BUF_SHIFT=19 CONFIG_LZ4_DECOMPRESS=y CONFIG_LZO_DECOMPRESS=y -CONFIG_MAC80211=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -CONFIG_MAC80211_HAS_RC=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_MAC80211_LEDS is not set -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y CONFIG_MAGIC_SYSRQ=y CONFIG_MDIO_BOARDINFO=y CONFIG_MDIO_SUN4I=y @@ -377,6 +359,7 @@ CONFIG_STOP_MACHINE=y CONFIG_STRICT_DEVMEM=y # CONFIG_SUN4I_EMAC is not set CONFIG_SUN4I_TIMER=y +# CONFIG_SUNXI_WATCHDOG is not set CONFIG_SWP_EMULATE=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TASKSTATS=y @@ -398,12 +381,9 @@ CONFIG_USB_COMMON=y CONFIG_USB_DEBUG=y CONFIG_USB_EHCI_HCD=y # CONFIG_USB_EHCI_HCD_PLATFORM is not set -CONFIG_USB_NET_AX88179_178A=y -CONFIG_USB_NET_AX8817X=y CONFIG_USB_STORAGE=y CONFIG_USB_SUNXI_EHCI=y CONFIG_USB_SUPPORT=y -CONFIG_USB_USBNET=y # CONFIG_USER_NS is not set CONFIG_USE_GENERIC_SMP_HELPERS=y CONFIG_USE_OF=y diff --git a/target/linux/sunxi/modules.mk b/target/linux/sunxi/modules.mk index 9a4782ddf27..374cef2b179 100644 --- a/target/linux/sunxi/modules.mk +++ b/target/linux/sunxi/modules.mk @@ -66,3 +66,18 @@ endef $(eval $(call KernelPackage,sun4i-emac)) + +define KernelPackage/wdt-sunxi + SUBMENU:=$(OTHER_MENU) + TITLE:=AllWinner sunXi Watchdog timer + KCONFIG:=CONFIG_SUNXI_WATCHDOG + FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/sunxi_wdt.ko + AUTOLOAD:=$(call AutoLoad,51,sunxi_wdt) +endef + +define KernelPackage/wdt-sunxi/description + Kernel module for AllWinner sunXi watchdog timer. +endef + +$(eval $(call KernelPackage,wdt-sunxi)) + diff --git a/target/linux/sunxi/patches-3.12/165-dt-usb-update-vbus-voltage.patch b/target/linux/sunxi/patches-3.12/165-dt-usb-update-vbus-voltage.patch new file mode 100644 index 00000000000..0db0f2b8f60 --- /dev/null +++ b/target/linux/sunxi/patches-3.12/165-dt-usb-update-vbus-voltage.patch @@ -0,0 +1,109 @@ +From b0a614458fb67fdb53e1b5518dabb85d688b196e Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 17 Dec 2013 22:59:17 +0100 +Subject: [PATCH] ARM: dts: sunxi: usb Vbus is 5v not 3.3v + +Signed-off-by: Hans de Goede +--- + arch/arm/boot/dts/sun4i-a10-a1000.dts | 8 ++++---- + arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 8 ++++---- + arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 4 ++-- + arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 8 ++++---- + 4 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts +index e3bfc59..315e607 100644 +--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts ++++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts +@@ -147,8 +147,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + regulator-name = "usb1-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 6 0>; + }; +@@ -158,8 +158,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb2_vbus_pin>; + regulator-name = "usb2-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 3 0>; + }; +diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts +index 48864a4..0bd2aae 100644 +--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts ++++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts +@@ -158,8 +158,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + regulator-name = "usb1-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 6 0>; + }; +@@ -169,8 +169,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb2_vbus_pin>; + regulator-name = "usb2-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 3 0>; + }; +diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts +index 4b73e3e..b255d1b 100644 +--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts ++++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts +@@ -104,8 +104,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + regulator-name = "usb1-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 6 11 0>; + }; +diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +index 10ea99d..144b11a 100644 +--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts ++++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +@@ -141,8 +141,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + regulator-name = "usb1-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 6 0>; + }; +@@ -152,8 +152,8 @@ + pinctrl-names = "default"; + pinctrl-0 = <&usb2_vbus_pin>; + regulator-name = "usb2-vbus"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 7 3 0>; + }; +-- +1.8.5.1 + diff --git a/target/linux/sunxi/patches-3.12/200-emac-add-missing-free_irq.patch b/target/linux/sunxi/patches-3.12/200-emac-add-missing-free_irq.patch new file mode 100644 index 00000000000..4b1be392819 --- /dev/null +++ b/target/linux/sunxi/patches-3.12/200-emac-add-missing-free_irq.patch @@ -0,0 +1,46 @@ +From e9c56f8d2f851fb6d6ce6794c0f5463b862a878e Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Tue, 10 Dec 2013 19:40:43 +0100 +Subject: [PATCH] net: allwinner: emac: Add missing free_irq + +The sun4i-emac driver uses devm_request_irq at .ndo_open time, but relies on +the managed device mechanism to actually free it. This causes an issue whenever +someone wants to restart the interface, the interrupt still being held, and not +yet released. + +Fall back to using the regular request_irq at .ndo_open time, and introduce a +free_irq during .ndo_stop. + +Signed-off-by: Maxime Ripard +Cc: stable@vger.kernel.org # 3.11+ +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/allwinner/sun4i-emac.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c +index 50b853a..46dfb13 100644 +--- a/drivers/net/ethernet/allwinner/sun4i-emac.c ++++ b/drivers/net/ethernet/allwinner/sun4i-emac.c +@@ -717,8 +717,7 @@ static int emac_open(struct net_device *dev) + if (netif_msg_ifup(db)) + dev_dbg(db->dev, "enabling %s\n", dev->name); + +- if (devm_request_irq(db->dev, dev->irq, &emac_interrupt, +- 0, dev->name, dev)) ++ if (request_irq(dev->irq, &emac_interrupt, 0, dev->name, dev)) + return -EAGAIN; + + /* Initialize EMAC board */ +@@ -774,6 +773,8 @@ static int emac_stop(struct net_device *ndev) + + emac_shutdown(ndev); + ++ free_irq(ndev->irq, ndev); ++ + return 0; + } + +-- +1.8.5.1 + diff --git a/target/linux/sunxi/patches-3.12/201-dt-add-emac-aliases.patch b/target/linux/sunxi/patches-3.12/201-dt-add-emac-aliases.patch new file mode 100644 index 00000000000..815cccb951a --- /dev/null +++ b/target/linux/sunxi/patches-3.12/201-dt-add-emac-aliases.patch @@ -0,0 +1,70 @@ +From e751cce9b7b106b62c6d2c4f098c28c7feb10ef6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Emilio=20L=C3=B3pez?= +Date: Sat, 16 Nov 2013 15:17:29 -0300 +Subject: [PATCH] ARM: sunxi: dt: add EMAC aliases +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +U-Boot uses the ethernet0 alias to locate the right node to fill in +the MAC address of the first ethernet interface. This patch adds the +alias on all the sunxi SoCs with EMAC. In this way, people using +ethernet in U-Boot (eg, for tftp) can keep a consistent address on both +U-Boot and Linux with no additional effort. + +Signed-off-by: Emilio López +Signed-off-by: Maxime Ripard +--- + arch/arm/boot/dts/sun4i-a10.dtsi | 4 ++++ + arch/arm/boot/dts/sun5i-a10s.dtsi | 4 ++++ + arch/arm/boot/dts/sun7i-a20.dtsi | 4 ++++ + 3 files changed, 12 insertions(+) + +diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi +index f11f292..0bf70ee 100644 +--- a/arch/arm/boot/dts/sun4i-a10.dtsi ++++ b/arch/arm/boot/dts/sun4i-a10.dtsi +@@ -15,6 +15,10 @@ + / { + interrupt-parent = <&intc>; + ++ aliases { ++ ethernet0 = &emac; ++ }; ++ + cpus { + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi +index 5247674..b4764be 100644 +--- a/arch/arm/boot/dts/sun5i-a10s.dtsi ++++ b/arch/arm/boot/dts/sun5i-a10s.dtsi +@@ -16,6 +16,10 @@ + / { + interrupt-parent = <&intc>; + ++ aliases { ++ ethernet0 = &emac; ++ }; ++ + cpus { + cpu@0 { + compatible = "arm,cortex-a8"; +diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi +index 830fcd5..74bf906 100644 +--- a/arch/arm/boot/dts/sun7i-a20.dtsi ++++ b/arch/arm/boot/dts/sun7i-a20.dtsi +@@ -16,6 +16,10 @@ + / { + interrupt-parent = <&gic>; + ++ aliases { ++ ethernet0 = &emac; ++ }; ++ + cpus { + #address-cells = <1>; + #size-cells = <0>; +-- +1.8.5.1 + diff --git a/target/linux/sunxi/patches-3.12/210-fix-a20-irqtypes.patch b/target/linux/sunxi/patches-3.12/210-fix-a20-irqtypes.patch new file mode 100644 index 00000000000..e1c7c9a39f5 --- /dev/null +++ b/target/linux/sunxi/patches-3.12/210-fix-a20-irqtypes.patch @@ -0,0 +1,179 @@ +From 3e52e08e7f8f9cb1137f232e3bfa00f89ed27475 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Sat, 7 Dec 2013 12:38:32 +0100 +Subject: [PATCH] ARM: sun7i: dt: Fix interrupt trigger types + +The Allwinner A20 uses the ARM GIC as its internal interrupts controller. The +GIC can work on several interrupt triggers, and the A20 was actually setting it +up to use a rising edge as a trigger, while it was actually a level high +trigger, leading to some interrupts that would be completely ignored if the +edge was missed. + +Signed-off-by: Maxime Ripard +Reported-by: Hans de Goede +Signed-off-by: Hans de Goede +--- + arch/arm/boot/dts/sun7i-a20.dtsi | 42 ++++++++++++++++++++-------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi +index f1a6b24..0b7fcc1 100644 +--- a/arch/arm/boot/dts/sun7i-a20.dtsi ++++ b/arch/arm/boot/dts/sun7i-a20.dtsi +@@ -298,7 +298,7 @@ + emac: ethernet@01c0b000 { + compatible = "allwinner,sun4i-emac"; + reg = <0x01c0b000 0x1000>; +- interrupts = <0 55 1>; ++ interrupts = <0 55 4>; + clocks = <&ahb_gates 17>; + status = "disabled"; + }; +@@ -324,7 +324,7 @@ + pio: pinctrl@01c20800 { + compatible = "allwinner,sun7i-a20-pinctrl"; + reg = <0x01c20800 0x400>; +- interrupts = <0 28 1>; ++ interrupts = <0 28 4>; + clocks = <&apb0_gates 5>; + gpio-controller; + interrupt-controller; +@@ -405,12 +405,12 @@ + timer@01c20c00 { + compatible = "allwinner,sun4i-timer"; + reg = <0x01c20c00 0x90>; +- interrupts = <0 22 1>, +- <0 23 1>, +- <0 24 1>, +- <0 25 1>, +- <0 67 1>, +- <0 68 1>; ++ interrupts = <0 22 4>, ++ <0 23 4>, ++ <0 24 4>, ++ <0 25 4>, ++ <0 67 4>, ++ <0 68 4>; + clocks = <&osc24M>; + }; + +@@ -432,7 +432,7 @@ + uart0: serial@01c28000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28000 0x400>; +- interrupts = <0 1 1>; ++ interrupts = <0 1 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 16>; +@@ -442,7 +442,7 @@ + uart1: serial@01c28400 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28400 0x400>; +- interrupts = <0 2 1>; ++ interrupts = <0 2 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 17>; +@@ -452,7 +452,7 @@ + uart2: serial@01c28800 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28800 0x400>; +- interrupts = <0 3 1>; ++ interrupts = <0 3 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 18>; +@@ -462,7 +462,7 @@ + uart3: serial@01c28c00 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28c00 0x400>; +- interrupts = <0 4 1>; ++ interrupts = <0 4 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 19>; +@@ -472,7 +472,7 @@ + uart4: serial@01c29000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29000 0x400>; +- interrupts = <0 17 1>; ++ interrupts = <0 17 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 20>; +@@ -482,7 +482,7 @@ + uart5: serial@01c29400 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29400 0x400>; +- interrupts = <0 18 1>; ++ interrupts = <0 18 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 21>; +@@ -492,7 +492,7 @@ + uart6: serial@01c29800 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29800 0x400>; +- interrupts = <0 19 1>; ++ interrupts = <0 19 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 22>; +@@ -502,7 +502,7 @@ + uart7: serial@01c29c00 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29c00 0x400>; +- interrupts = <0 20 1>; ++ interrupts = <0 20 4>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&apb1_gates 23>; +@@ -512,7 +512,7 @@ + i2c0: i2c@01c2ac00 { + compatible = "allwinner,sun4i-i2c"; + reg = <0x01c2ac00 0x400>; +- interrupts = <0 7 1>; ++ interrupts = <0 7 4>; + clocks = <&apb1_gates 0>; + clock-frequency = <100000>; + status = "disabled"; +@@ -521,7 +521,7 @@ + i2c1: i2c@01c2b000 { + compatible = "allwinner,sun4i-i2c"; + reg = <0x01c2b000 0x400>; +- interrupts = <0 8 1>; ++ interrupts = <0 8 4>; + clocks = <&apb1_gates 1>; + clock-frequency = <100000>; + status = "disabled"; +@@ -530,7 +530,7 @@ + i2c2: i2c@01c2b400 { + compatible = "allwinner,sun4i-i2c"; + reg = <0x01c2b400 0x400>; +- interrupts = <0 9 1>; ++ interrupts = <0 9 4>; + clocks = <&apb1_gates 2>; + clock-frequency = <100000>; + status = "disabled"; +@@ -539,7 +539,7 @@ + i2c3: i2c@01c2b800 { + compatible = "allwinner,sun4i-i2c"; + reg = <0x01c2b800 0x400>; +- interrupts = <0 88 1>; ++ interrupts = <0 88 4>; + clocks = <&apb1_gates 3>; + clock-frequency = <100000>; + status = "disabled"; +@@ -548,7 +548,7 @@ + i2c4: i2c@01c2bc00 { + compatible = "allwinner,sun4i-i2c"; + reg = <0x01c2bc00 0x400>; +- interrupts = <0 89 1>; ++ interrupts = <0 89 4>; + clocks = <&apb1_gates 15>; + clock-frequency = <100000>; + status = "disabled"; +-- +1.8.5.1 + -- 2.30.2