[kernel] setup config for tegra based arm boards, add device tree patches for arm build tegra and omap kernel

Dennis Gilmore ausil at fedoraproject.org
Tue Aug 16 18:01:04 UTC 2011


commit 986a9f3a2efbfbcb4a742e4879920982ee4af05e
Author: Dennis Gilmore <dennis at ausil.us>
Date:   Tue Aug 16 11:33:15 2011 -0500

    setup config for tegra based arm boards, add device tree
    patches for arm build tegra and omap kernel on arm

 Makefile.config                                    |    8 ++-
 arm-omap-dt-compat.patch                           |   42 +++++++++
 ...port-reading-mac-address-from-device-tree.patch |   92 ++++++++++++++++++++
 config-arm-tegra                                   |   71 +++++++++++++++
 kernel.spec                                        |   63 +++++++++++++-
 5 files changed, 272 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.config b/Makefile.config
index 0e71c35..7415c91 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -9,7 +9,7 @@ CONFIGFILES	= \
 	$(CFG)-i686-PAE.config $(CFG)-i686-PAEdebug.config \
 	$(CFG)-x86_64.config $(CFG)-x86_64-debug.config \
 	$(CFG)-s390x.config \
-	$(CFG)-arm.config $(CFG)-armv7l-omap.config \
+	$(CFG)-arm.config $(CFG)-armv7l-omap.config $(CFG)-armv7l-tegra.config \
 	$(CFG)-ppc.config $(CFG)-ppc-smp.config \
 	$(CFG)-sparc64.config  \
 	$(CFG)-ppc64.config $(CFG)-ppc64-debug.config \
@@ -39,6 +39,9 @@ temp-arm-generic: config-arm-generic temp-generic
 temp-armv7l-omap-generic: config-arm-omap-generic temp-arm-generic
 	perl merge.pl $^  > $@
 
+temp-armv7l-tegra: config-arm-tegra temp-arm-generic
+	perl merge.pl $^  > $@
+
 temp-x86-32: config-x86-32-generic config-x86-generic
 	perl merge.pl $^  > $@
 
@@ -111,6 +114,9 @@ kernel-$(VERSION)-arm.config: /dev/null temp-arm-generic
 kernel-$(VERSION)-armv7l-omap.config: /dev/null temp-armv7l-omap-generic
 	perl merge.pl $^ arm > $@
 
+kernel-$(VERSION)-armv7l-tegra.config: /dev/null temp-armv7l-tegra
+	perl merge.pl $^ arm > $@
+
 kernel-$(VERSION)-ppc.config: /dev/null temp-powerpc32-generic
 	perl merge.pl $^ powerpc > $@
 
diff --git a/arm-omap-dt-compat.patch b/arm-omap-dt-compat.patch
new file mode 100644
index 0000000..ab7cd0a
--- /dev/null
+++ b/arm-omap-dt-compat.patch
@@ -0,0 +1,42 @@
+diff -up linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap3beagle.c.fdt linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap3beagle.c
+--- linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap3beagle.c.fdt	2011-08-04 16:51:12.034188064 -0500
++++ linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap3beagle.c	2011-08-04 22:13:52.801156923 -0500
+@@ -591,6 +591,11 @@ static void __init omap3_beagle_init(voi
+ 	beagle_opp_init();
+ }
+ 
++static const char *omap3_beagle_dt_match[] __initdata = {
++	"ti,omap3-beagle",
++	NULL
++};
++
+ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
+ 	/* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
+ 	.boot_params	= 0x80000100,
+@@ -600,4 +605,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagl
+ 	.init_irq	= omap3_beagle_init_irq,
+ 	.init_machine	= omap3_beagle_init,
+ 	.timer		= &omap_timer,
++	.dt_compat      = omap3_beagle_dt_match,
+ MACHINE_END
+diff -up linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap4panda.c.fdt linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap4panda.c
+--- linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap4panda.c.fdt	2011-08-04 16:51:12.092169023 -0500
++++ linux-2.6.39.armv7l/arch/arm/mach-omap2/board-omap4panda.c	2011-08-04 22:15:29.200157437 -0500
+@@ -708,6 +708,11 @@ static void __init omap4_panda_map_io(vo
+ 	omap44xx_map_common_io();
+ }
+ 
++static const char *omap4_panda_match[] __initdata = {
++	"ti,omap4-panda",
++	NULL,
++};
++
+ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
+ 	/* Maintainer: David Anders - Texas Instruments Inc */
+ 	.boot_params	= 0x80000100,
+@@ -717,4 +722,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda 
+ 	.init_irq	= gic_init_irq,
+ 	.init_machine	= omap4_panda_init,
+ 	.timer		= &omap_timer,
++	.dt_compat      = omap4_panda_match,
+ MACHINE_END
diff --git a/arm-smsc-support-reading-mac-address-from-device-tree.patch b/arm-smsc-support-reading-mac-address-from-device-tree.patch
new file mode 100644
index 0000000..a36c683
--- /dev/null
+++ b/arm-smsc-support-reading-mac-address-from-device-tree.patch
@@ -0,0 +1,92 @@
+From 0b608345e114681f66ca0a3cf9d9434728da62ce Mon Sep 17 00:00:00 2001
+From: Ken Cox <ken at coxcampers.net>
+Date: Thu, 23 Jun 2011 10:36:43 -0500
+Subject: [PATCH] Support reading mac address from device tree.
+
+If CONFIG_OF is enabled, we will try to read the mac address from the device tree.  This enables us the ability to have a "static" mac address on arm boards such as the pandaboard and beagleboard which generate random mac addresses.
+---
+ drivers/net/usb/smsc75xx.c |   17 +++++++++++++++++
+ drivers/net/usb/smsc95xx.c |   18 +++++++++++++++++-
+ 2 files changed, 34 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
+index 753ee6e..ac0a200 100644
+--- a/drivers/net/usb/smsc75xx.c
++++ b/drivers/net/usb/smsc75xx.c
+@@ -29,6 +29,7 @@
+ #include <linux/crc32.h>
+ #include <linux/usb/usbnet.h>
+ #include <linux/slab.h>
++#include <linux/of_device.h>
+ #include "smsc75xx.h"
+ 
+ #define SMSC_CHIPNAME			"smsc75xx"
+@@ -658,6 +659,22 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
+ 
+ static void smsc75xx_init_mac_address(struct usbnet *dev)
+ {
++	void *address;
++#ifdef CONFIG_OF
++	struct device_node *np;
++
++	/* try the device tree */
++	np = of_find_node_by_name(NULL, "smsc75xx");
++	if (np) {
++		address = of_get_property(np, "local-mac-address", NULL);
++		if (address) {
++			memcpy(dev->net->dev_addr, address, ETH_ALEN);
++			netif_dbg(dev, ifup, dev->net, "MAC address read from device tree\n");
++			return;
++		}
++	}
++#endif
++
+ 	/* try reading mac address from EEPROM */
+ 	if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
+ 			dev->net->dev_addr) == 0) {
+diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
+index bc86f4b..c83942d 100644
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -29,6 +29,7 @@
+ #include <linux/crc32.h>
+ #include <linux/usb/usbnet.h>
+ #include <linux/slab.h>
++#include <linux/of_device.h>
+ #include "smsc95xx.h"
+ 
+ #define SMSC_CHIPNAME			"smsc95xx"
+@@ -639,6 +640,22 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
+ 
+ static void smsc95xx_init_mac_address(struct usbnet *dev)
+ {
++	void *address;
++#ifdef CONFIG_OF
++	struct device_node *np;
++
++	/* try the device tree */
++	np = of_find_node_by_name(NULL, "smsc95xx");
++	if (np) {
++		address = of_get_property(np, "local-mac-address", NULL);
++		if (address) {
++			memcpy(dev->net->dev_addr, address, ETH_ALEN);
++			netif_dbg(dev, ifup, dev->net, "MAC address read from device tree\n");
++			return;
++		}
++	}
++#endif
++
+ 	/* try reading mac address from EEPROM */
+ 	if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
+ 			dev->net->dev_addr) == 0) {
+@@ -648,7 +665,6 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
+ 			return;
+ 		}
+ 	}
+-
+ 	/* no eeprom, or eeprom values are invalid. generate random MAC */
+ 	random_ether_addr(dev->net->dev_addr);
+ 	netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
+-- 
+1.7.2.3
+
diff --git a/config-arm-tegra b/config-arm-tegra
new file mode 100644
index 0000000..31d89b3
--- /dev/null
+++ b/config-arm-tegra
@@ -0,0 +1,71 @@
+CONFIG_ARCH_TEGRA=y
+CONFIG_MACH_HARMONY=y
+CONFIG_MACH_KAEN=y
+CONFIG_MACH_PAZ00=y
+CONFIG_MACH_TRIMSLICE=y
+CONFIG_MACH_WARIO=y
+CONFIG_TEGRA_DEBUG_UARTD=y
+CONFIG_ARM_ERRATA_742230=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=2
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+
+CONFIG_I2C_TEGRA=y
+
+CONFIG_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_SDHCI_TEGRA=y
+
+# CONFIG_RCU_BOOST is not set
+CONFIG_TEGRA_SYSTEM_DMA=y
+CONFIG_TEGRA_EMC_SCALING_ENABLE=y
+CONFIG_ARM_THUMBEE=y
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_CACHE_L2X0=y
+CONFIG_ARM_ERRATA_430973=y
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+CONFIG_PL310_ERRATA_588369=y
+CONFIG_ARM_ERRATA_720789=y
+# CONFIG_PL310_ERRATA_727915 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_753970 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+CONFIG_SMP_ON_UP=y
+CONFIG_LOCAL_TIMERS=y
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_HW_PERF_EVENTS=y
+# CONFIG_NEON is not set
+# CONFIG_RFKILL_GPIO is not set
+CONFIG_KEYBOARD_TEGRA=y
+# CONFIG_MPCORE_WATCHDOG is not set
+CONFIG_USB_EHCI_TEGRA=y
+CONFIG_RTC_DRV_TEGRA=m
+CONFIG_MFD_NVEC=y
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_RCU_CPU_STALL_VERBOSE is not set
+# CONFIG_PREEMPT_TRACER is not set
+CONFIG_KEYBOARD_NVEC=y
+CONFIG_SERIO_NVEC_PS2=y
+CONFIG_NVEC_POWER=y
+
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEBUG=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_STAT_DETAILS=y
diff --git a/kernel.spec b/kernel.spec
index 29dda4e..c173ea8 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -121,6 +121,10 @@ Summary: The Linux kernel
 %define with_bootwrapper %{?_without_bootwrapper: 0} %{?!_without_bootwrapper: 1}
 # Want to build a the vsdo directories installed
 %define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
+# ARM OMAP (Beagle/Panda Board)
+%define with_omap      %{?_without_omap:      0} %{?!_without_omap:      1}
+# kernel-tegra (only valid for arm)
+%define with_tegra       %{?_without_tegra:       0} %{?!_without_tegra:       1}
 
 # Build the kernel-doc package, but don't fail the build if it botches.
 # Here "true" means "continue" and "false" means "fail the build".
@@ -229,6 +233,12 @@ Summary: The Linux kernel
 %define with_pae 0
 %endif
 
+# kernel-tegra and omap is only built on arm
+%ifnarch %{arm}
+%define with_tegra 0
+%define with_omap 0
+%endif
+
 # if requested, only build base kernel
 %if %{with_baseonly}
 %define with_smp 0
@@ -383,8 +393,10 @@ Summary: The Linux kernel
 %define image_install_path boot
 %define asmarch arm
 %define hdrarch arm
-%define make_target vmlinux
-%define kernel_image vmlinux
+%define make_target bzImage
+%define kernel_image arch/arm/boot/zImage
+%define with_up 0
+%define with_perf 0
 %endif
 
 %if %{nopatches}
@@ -407,7 +419,7 @@ Summary: The Linux kernel
 # Which is a BadThing(tm).
 
 # We only build kernel-headers on the following...
-%define nobuildarches i386 s390 sparc sparcv9 %{arm}
+%define nobuildarches i386 s390 sparc sparcv9
 
 %ifarch %nobuildarches
 %define with_up 0
@@ -561,6 +573,7 @@ Source90: config-sparc64-generic
 
 Source100: config-arm-generic
 Source110: config-arm-omap-generic
+Source111: config-arm-tegra
 
 # This file is intentionally left empty in the stock kernel. Its a nicety
 # added for those wanting to do custom rebuilds with altered config opts.
@@ -703,6 +716,9 @@ Patch13003: efi-dont-map-boot-services-on-32bit.patch
 
 Patch20000: utrace.patch
 
+# Flattened devicetree support
+Patch21000: arm-omap-dt-compat.patch
+Patch21001: arm-smsc-support-reading-mac-address-from-device-tree.patch
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -895,6 +911,19 @@ It should only be installed when trying to gather additional information
 on kernel bugs, as some of these options impact performance noticably.
 
 
+%define variant_summary The Linux kernel compiled for TI-OMAP boards
+%kernel_variant_package omap
+%description omap
+This package includes a version of the Linux kernel with support for
+TI-OMAP based systems, i.e., BeagleBoard-xM.
+
+%define variant_summary The Linux kernel compiled for tegra boards
+%kernel_variant_package tegra
+%description tegra
+This package includes a version of the Linux kernel with support for
+nvidia tegra based systems, i.e., trimslice, ac-100.
+
+
 %prep
 # do a few sanity-checks for --with *only builds
 %if %{with_baseonly}
@@ -1158,6 +1187,12 @@ ApplyOptionalPatch linux-2.6-upstream-reverts.patch -R
 ApplyPatch linux-2.6.29-sparc-IOC_TYPECHECK.patch
 
 #
+# ARM
+#
+ApplyPatch arm-omap-dt-compat.patch
+ApplyPatch arm-smsc-support-reading-mac-address-from-device-tree.patch
+
+#
 # Exec shield
 #
 ApplyPatch linux-2.6-i386-nx-emulation.patch
@@ -1595,6 +1630,14 @@ BuildKernel %make_target %kernel_image PAEdebug
 BuildKernel %make_target %kernel_image PAE
 %endif
 
+%if %{with_omap}
+BuildKernel %make_target %kernel_image omap
+%endif
+
+%if %{with_tegra}
+BuildKernel %make_target %kernel_image tegra
+%endif
+
 %if %{with_up}
 BuildKernel %make_target %kernel_image
 %endif
@@ -1787,6 +1830,12 @@ fi}\
 %kernel_variant_post -v PAEdebug -r (kernel|kernel-smp)
 %kernel_variant_preun PAEdebug
 
+%kernel_variant_preun omap
+%kernel_variant_post -v omap
+
+%kernel_variant_preun tegra
+%kernel_variant_post -v tegra
+
 if [ -x /sbin/ldconfig ]
 then
     /sbin/ldconfig -X || exit $?
@@ -1897,6 +1946,8 @@ fi
 %kernel_variant_files %{with_debug} debug
 %kernel_variant_files %{with_pae} PAE
 %kernel_variant_files %{with_pae_debug} PAEdebug
+%kernel_variant_files %{with_omap} omap
+%kernel_variant_files %{with_tegra} tegra
 
 # plz don't put in a version string unless you're going to tag
 # and build.
@@ -1911,6 +1962,12 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Tue Aug 16 2011 Dennis Gilmore <dennis at ausil.us>
++- add config for arm tegra devices
++- setup kernel to build omap image (patch from David Marlin)
++- setup kernel to build tegra image based on omap work
++- add arm device tree patches
+
 * Tue Aug 16 2011 Josh Boyer <jwboyer at redhat.com>
 - Bring ARM config changes from David Marlin forward
 - Sync a handful of patches from f16


More information about the scm-commits mailing list