diff options
Diffstat (limited to 'arch/arm')
74 files changed, 1221 insertions, 783 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f1536a5b15..bc54e58d67 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -39,8 +39,8 @@ config ARCH_IMX bool "Freescale iMX-based" select GENERIC_GPIO -config ARCH_STM - bool "SigmaTel/FSL iMX-based" +config ARCH_MXS + bool "Freescale i.MX23/28 (mxs) based" select GENERIC_GPIO config ARCH_NETX @@ -71,13 +71,16 @@ source arch/arm/cpu/Kconfig source arch/arm/mach-at91/Kconfig source arch/arm/mach-ep93xx/Kconfig source arch/arm/mach-imx/Kconfig -source arch/arm/mach-stm/Kconfig +source arch/arm/mach-mxs/Kconfig source arch/arm/mach-netx/Kconfig source arch/arm/mach-nomadik/Kconfig source arch/arm/mach-omap/Kconfig source arch/arm/mach-s3c24xx/Kconfig source arch/arm/mach-versatile/Kconfig +config ARM_ASM_UNIFIED + bool + config AEABI bool "Use the ARM EABI to compile barebox" help diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c90960e565..57a045f967 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -35,13 +35,14 @@ CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-th endif CPPFLAGS += $(CFLAGS_ABI) $(arch-y) $(tune-y) +AFLAGS += -include asm/unified.h # Machine directory name. This list is sorted alphanumerically # by CONFIG_* macro name. machine-$(CONFIG_ARCH_AT91) := at91 machine-$(CONFIG_ARCH_EP93XX) := ep93xx machine-$(CONFIG_ARCH_IMX) := imx -machine-$(CONFIG_ARCH_STM) := stm +machine-$(CONFIG_ARCH_MXS) := mxs machine-$(CONFIG_ARCH_NOMADIK) := nomadik machine-$(CONFIG_ARCH_NETX) := netx machine-$(CONFIG_ARCH_OMAP) := omap diff --git a/arch/arm/boards/at91sam9m10g45ek/init.c b/arch/arm/boards/at91sam9m10g45ek/init.c index bb8b7bada6..77d51b7d99 100644 --- a/arch/arm/boards/at91sam9m10g45ek/init.c +++ b/arch/arm/boards/at91sam9m10g45ek/init.c @@ -40,6 +40,26 @@ #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> +/* + * board revision encoding + * bit 0-3: lcd type + * 0 => truly TFT1N4633-E (sam9m10g45-ek) + * 1 => LG philips LB043WQ1 (sam9m10-ekes and sam9g45-ekes) + */ +#define HAVE_LCD_TRULY_TFT1N4633E (0 << 0) +#define HAVE_LCD_LG_LB043WQ1 (1 << 0) +static void ek_set_board_revision(void) +{ + u32 rev; + +#ifdef CONFIG_LCD_LG_LB043WQ1 + rev = HAVE_LCD_LG_LB043WQ1; +#else + rev = HAVE_LCD_TRULY_TFT1N4633E; +#endif + armlinux_set_revision(rev); +} + static struct atmel_nand_data nand_pdata = { .ale = 21, .cle = 22, @@ -103,6 +123,7 @@ static int at91sam9m10g45ek_devices_init(void) armlinux_set_bootparams((void *)(AT91_CHIPSELECT_6 + 0x100)); armlinux_set_architecture(MACH_TYPE_AT91SAM9M10G45EK); + ek_set_board_revision(); return 0; } diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c index 76ff9068ff..d46431c302 100644 --- a/arch/arm/boards/chumby_falconwing/falconwing.c +++ b/arch/arm/boards/chumby_falconwing/falconwing.c @@ -22,13 +22,16 @@ #include <environment.h> #include <errno.h> #include <mci.h> +#include <usb/ehci.h> #include <asm/armlinux.h> #include <asm/io.h> +#include <asm/mmu.h> #include <generated/mach-types.h> #include <mach/imx-regs.h> #include <mach/clock.h> #include <mach/mci.h> #include <mach/fb.h> +#include <mach/usb.h> static struct memory_platform_data ram_pdata = { .name = "ram0", @@ -54,6 +57,22 @@ static struct device_d mci_dev = { .platform_data = &mci_pdata, }; +#define GPIO_LCD_RESET 50 +#define GPIO_LCD_BACKLIGHT 60 + +static void chumby_fb_enable(int enable) +{ + gpio_direction_output(GPIO_LCD_RESET, enable); + + /* Give the display a chance to sync before we enable + * the backlight to avoid flickering + */ + if (enable) + mdelay(100); + + gpio_direction_output(GPIO_LCD_BACKLIGHT, enable); +} + static struct fb_videomode falconwing_vmode = { /* * Nanovision NMA35QV65-B2-K01 (directly connected) @@ -79,11 +98,12 @@ static struct fb_videomode falconwing_vmode = { .flag = 0, }; -static struct imx_fb_videomode fb_mode = { +static struct imx_fb_platformdata fb_mode = { .mode_list = &falconwing_vmode, .mode_cnt = 1, /* the NMA35 is a 24 bit display, but only 18 bits are connected */ .ld_intf_width = STMLCDIF_18BIT, + .enable = chumby_fb_enable, }; static struct device_d ldcif_dev = { @@ -197,10 +217,10 @@ static const uint32_t pad_setup[] = { /* backlight control, to be controled by PWM, here we only want to disable it */ PWM2_GPIO | GPIO_OUT | GPIO_VALUE(0), /* 1 enables, 0 disables the backlight */ - /* send a reset signal to the USB hub */ + /* USB hub reset (active low) */ AUART1_TX_GPIO | GPIO_OUT | GPIO_VALUE(0), - /* USB power disable (FIXME what level to be switched off) */ + /* USB power (active high) */ AUART1_CTS_GPIO | GPIO_OUT | GPIO_VALUE(0), /* Detecting if a display is connected (0 = display attached) (external pull up) */ @@ -262,6 +282,28 @@ static const uint32_t pad_setup[] = { GPMI_RDY3_GPIO | GPIO_IN | PULLUP(1), }; +#ifdef CONFIG_MMU +static int falconwing_mmu_init(void) +{ + mmu_init(); + + arm_create_section(0x40000000, 0x40000000, 64, PMD_SECT_DEF_CACHED); + arm_create_section(0x50000000, 0x40000000, 64, PMD_SECT_DEF_UNCACHED); + + setup_dma_coherent(0x10000000); + +#if TEXT_BASE & (0x100000 - 1) +#warning cannot create vector section. Adjust TEXT_BASE to a 1M boundary +#else + arm_create_section(0x0, TEXT_BASE, 1, PMD_SECT_DEF_UNCACHED); +#endif + mmu_enable(); + + return 0; +} +postcore_initcall(falconwing_mmu_init); +#endif + /** * Try to register an environment storage on the attached MCI card * @return 0 on success @@ -298,6 +340,35 @@ static int register_persistant_environment(void) return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0"); } +static struct ehci_platform_data chumby_usb_pdata = { + .flags = EHCI_HAS_TT, + .hccr_offset = 0x100, + .hcor_offset = 0x140, +}; + +static struct device_d usb_dev = { + .name = "ehci", + .id = -1, + .map_base = IMX_USB_BASE, + .size = 0x200, + .platform_data = &chumby_usb_pdata, +}; + +#define GPIO_USB_HUB_RESET 29 +#define GPIO_USB_HUB_POWER 26 + +static void falconwing_init_usb(void) +{ + /* power USB hub */ + gpio_direction_output(GPIO_USB_HUB_POWER, 1); + mdelay(1); + /* bring USB hub out of reset */ + gpio_direction_output(GPIO_USB_HUB_RESET, 1); + + imx_usb_phy_enable(); + register_device(&usb_dev); +} + static int falconwing_devices_init(void) { int i, rc; @@ -313,6 +384,8 @@ static int falconwing_devices_init(void) register_device(&mci_dev); register_device(&ldcif_dev); + falconwing_init_usb(); + armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void*)(sdram_dev.map_base + 0x100)); armlinux_set_architecture(MACH_TYPE_CHUMBY); diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/_update b/arch/arm/boards/eukrea_cpuimx25/env/bin/_update deleted file mode 100644 index 014bce3512..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/_update +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -if [ -z "$part" -o -z "$image" ]; then - echo "define \$part and \$image" - exit 1 -fi - -if [ ! -e "$part" ]; then - echo "Partition $part does not exist" - exit 1 -fi - -if [ $# = 1 ]; then - image=$1 -fi - -if [ x$ip = xdhcp ]; then - dhcp -fi - -ping $eth0.serverip -if [ $? -ne 0 ] ; then - echo "update aborted" - exit 1 -fi - -unprotect $part - -echo -echo "erasing partition $part" -erase $part - -echo -echo "flashing $image to $part" -echo -tftp $image $part diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/boot b/arch/arm/boards/eukrea_cpuimx25/env/bin/boot deleted file mode 100644 index 2d9b3af01c..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/boot +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -. /env/config - -if [ x$1 = xjffS2 ]; then - root=jffs2 - kernel=nand -fi - -if [ x$1 = xubifs ]; then - root=ubifs - kernel=nand -fi - -if [ x$1 = xnet ]; then - root=net - kernel=net -fi - -if [ x$ip = xdhcp ]; then - bootargs="$bootargs ip=dhcp" -else - if [ x$ip = xoff ]; then - bootargs="$bootargs ip=off" - else - bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" - fi -fi - -if [ x$root = xjffs2 ]; then - bootargs="$bootargs root=/dev/mtdblock$rootpartnum_nand rootfstype=jffs2" -fi - -if [ x$root = xubifs ]; then - bootargs="$bootargs root=ubi0:$ubiroot ubi.mtd=$rootpartnum_nand rootfstype=ubifs" -fi - -if [ x$root = xnet ]; then - bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp" -fi - -bootargs="$bootargs mtdparts=mxc_nand:$nand_parts" - -if [ $kernel = net ]; then - if [ x$ip = xdhcp ]; then - dhcp - fi - tftp $uimage uImage || exit 1 - bootm uImage -else - bootm /dev/nand0.kernel.bb -fi - diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/hush_hack b/arch/arm/boards/eukrea_cpuimx25/env/bin/hush_hack deleted file mode 100644 index 5fffa92ecd..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/hush_hack +++ /dev/null @@ -1 +0,0 @@ -nand -a /dev/nand0.* diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/init b/arch/arm/boards/eukrea_cpuimx25/env/bin/init deleted file mode 100644 index 47328759bc..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/init +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -PATH=/env/bin -export PATH - -. /env/config -if [ -e /dev/nand0 ]; then - addpart /dev/nand0 $nand_parts - - # Uh, oh, hush first expands wildcards and then starts executing - # commands. What a bug! - source /env/bin/hush_hack -fi - -if [ -f /env/logo.bmp ]; then - bmp /env/logo.bmp - fb0.enable=1 -elif [ -f /env/logo.bmp.lzo ]; then - unlzo /env/logo.bmp.lzo /logo.bmp - bmp /logo.bmp - fb0.enable=1 -fi - -if [ -z $eth0.ethaddr ]; then - while [ -z $eth0.ethaddr ]; do - readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr - done - echo -a /env/config "eth0.ethaddr=$eth0.ethaddr" - saveenv -fi - -echo -echo -n "Hit any key to stop autoboot: " -timeout -a $autoboot_timeout -if [ $? != 0 ]; then - echo - echo "type update_kernel [<imagename>] to update kernel into flash" - echo "type update_root [<imagename>] to update rootfs into flash" - echo - exit -fi - -boot diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board new file mode 100644 index 0000000000..72b4ab32cd --- /dev/null +++ b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ -f /env/logo.bmp ]; then + bmp /env/logo.bmp + fb0.enable=1 +elif [ -f /env/logo.bmp.lzo ]; then + unlzo /env/logo.bmp.lzo /logo.bmp + bmp /logo.bmp + fb0.enable=1 +fi + +if [ -z $eth0.ethaddr ]; then + while [ -z $eth0.ethaddr ]; do + readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr + done + echo -a /env/config "eth0.ethaddr=$eth0.ethaddr" + saveenv +fi diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/update_kernel b/arch/arm/boards/eukrea_cpuimx25/env/bin/update_kernel deleted file mode 100644 index c2d2cc3fa9..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/update_kernel +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -. /env/config - -image=$uimage -part=/dev/nand0.kernel.bb - -. /env/bin/_update $1 diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/update_root b/arch/arm/boards/eukrea_cpuimx25/env/bin/update_root deleted file mode 100644 index dd89a5afad..0000000000 --- a/arch/arm/boards/eukrea_cpuimx25/env/bin/update_root +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -. /env/config - -image=$rootfs -part=/dev/nand0.root.bb - -. /env/bin/_update $1 diff --git a/arch/arm/boards/eukrea_cpuimx25/env/config b/arch/arm/boards/eukrea_cpuimx25/env/config index 3e41ec8b98..927010c255 100644 --- a/arch/arm/boards/eukrea_cpuimx25/env/config +++ b/arch/arm/boards/eukrea_cpuimx25/env/config @@ -1,27 +1,48 @@ #!/bin/sh -# can be either 'net' or 'jffs2' or 'ubifs' -kernel=nand -root=ubifs +# otg port mode : can be 'host' or 'device' +otg_mode="device" -basedir=cpuimx25 -uimage=$basedir/uImage -rootfs=$basedir/rootfs - -autoboot_timeout=1 - -nfsroot="" -bootargs="console=ttymxc0,115200" - -nand_parts="256k(barebox)ro,128k(bareboxenv),2432k(kernel),-(root)" -rootpartnum_nand=3 -ubiroot="eukrea-cpuimx25-rootfs" +machine=eukrea-cpuimx25 # use 'dhcp' to do dhcp in barebox and in kernel -ip=off +# use 'none' if you want to skip kernel ip autoconfiguration +ip=none # or set your networking parameters here #eth0.ipaddr=a.b.c.d #eth0.netmask=a.b.c.d #eth0.gateway=a.b.c.d #eth0.serverip=a.b.c.d + +# can be either 'net' or 'nand' +kernel_loc=nand +# can be either 'net', 'nand' or 'initrd' +rootfs_loc=nand + +# rootfs +rootfs_type=ubifs +rootfsimage=$machine/rootfs.$rootfs_type + +# kernel +kernelimage_type=uimage +kernelimage=$machine/uImage-${machine}.bin + +# barebox and it's env +bareboximage=$machine/barebox-${machine}.bin +bareboxenvimage=$machine/bareboxenv-${machine}.bin + +nfsroot="$eth0.serverip:/srv/nfs/$machine" + +autoboot_timeout=1 + +bootargs="console=ttymxc0,115200 otg_mode=$otg_mode" + +nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)" +rootfs_mtdblock_nand=3 +nand_device="mxc_nand" +ubiroot="$machine-rootfs" +device_type="nand" + +# set a fancy prompt (if support is compiled in) +PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m " diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index 3048c3fbcf..ce9be97923 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -31,6 +31,7 @@ #include <mach/gpio.h> #include <asm/io.h> #include <asm/mmu.h> +#include <led.h> #include <partition.h> #include <generated/mach-types.h> @@ -132,6 +133,11 @@ static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = { .dmacr = 0x80040060, }; +struct gpio_led led0 = { + .gpio = 2 * 32 + 19, + .active_low = 1, +}; + #ifdef CONFIG_USB static void imx25_usb_init(void) { @@ -243,6 +249,8 @@ static struct pad_desc eukrea_cpuimx25_pads[] = { MX25_PAD_SD1_DATA1__DAT1, MX25_PAD_SD1_DATA2__DAT2, MX25_PAD_SD1_DATA3__DAT3, + /* LED */ + MX25_PAD_POWER_FAIL__GPIO19, }; static int eukrea_cpuimx25_devices_init(void) @@ -252,6 +260,8 @@ static int eukrea_cpuimx25_devices_init(void) mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, ARRAY_SIZE(eukrea_cpuimx25_pads)); + led_gpio_register(&led0); + imx25_add_fec(&fec_info); nand_info.width = 1; @@ -271,6 +281,9 @@ static int eukrea_cpuimx25_devices_init(void) gpio_direction_output(26, 1); gpio_set_value(26, 1); + /* LED : default OFF */ + gpio_direction_output(2 * 32 + 19, 1); + imx25_add_fb(&eukrea_cpuimx25_fb_data); imx25_add_i2c0(NULL); diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c index 6de41f7649..e8338a3aa9 100644 --- a/arch/arm/boards/karo-tx28/tx28-stk5.c +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c @@ -19,7 +19,10 @@ #include <errno.h> #include <mci.h> #include <fec.h> +#include <sizes.h> +#include <reloc.h> #include <asm/io.h> +#include <asm/sections.h> #include <mach/imx-regs.h> #include <mach/clock.h> #include <mach/mci.h> @@ -181,11 +184,15 @@ static struct fb_videomode tx28evk_vmodes[] = { }, }; +#define MAX_FB_SIZE SZ_2M + static struct imx_fb_videomode imxfb_mode = { .mode_list = tx28evk_vmodes, .mode_cnt = ARRAY_SIZE(tx28evk_vmodes), .dotclk_delay = 0, /* no adaption required */ .ld_intf_width = STMLCDIF_24BIT, /* full 24 bit */ + .fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE), + .fixed_screen_size = MAX_FB_SIZE, }; static struct device_d ldcif_dev = { @@ -352,6 +359,12 @@ void base_board_init(void) imx_set_sspclk(0, 100000000, 1); register_device(&mci_socket); + + if (imxfb_mode.fixed_screen < (void *)&_end) { + printf("Warning: fixed_screen overlaps barebox\n"); + imxfb_mode.fixed_screen = NULL; + } + register_device(&ldcif_dev); imx_enable_enetclk(); diff --git a/arch/arm/boards/karo-tx28/tx28.c b/arch/arm/boards/karo-tx28/tx28.c index 6f4ef4ec1e..5692171253 100644 --- a/arch/arm/boards/karo-tx28/tx28.c +++ b/arch/arm/boards/karo-tx28/tx28.c @@ -21,6 +21,7 @@ #include <asm/io.h> #include <generated/mach-types.h> #include <mach/imx-regs.h> +#include <asm/mmu.h> static struct memory_platform_data ram_pdata = { .name = "ram0", @@ -82,6 +83,28 @@ static const uint32_t tx28_pad_setup[] = { extern void base_board_init(void); +#ifdef CONFIG_MMU +static int tx28_mmu_init(void) +{ + mmu_init(); + + arm_create_section(0x40000000, 0x40000000, 128, PMD_SECT_DEF_CACHED); + arm_create_section(0x50000000, 0x40000000, 128, PMD_SECT_DEF_UNCACHED); + + setup_dma_coherent(0x10000000); + +#if TEXT_BASE & (0x100000 - 1) +#warning cannot create vector section. Adjust TEXT_BASE to a 1M boundary +#else + arm_create_section(0x0, TEXT_BASE, 1, PMD_SECT_DEF_UNCACHED); +#endif + mmu_enable(); + + return 0; +} +postcore_initcall(tx28_mmu_init); +#endif + static int tx28_devices_init(void) { int i; diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c index 32f7e74e43..c539ea1e7b 100644 --- a/arch/arm/boards/phycard-i.MX27/pca100.c +++ b/arch/arm/boards/phycard-i.MX27/pca100.c @@ -66,6 +66,13 @@ struct imx_nand_platform_data nand_info = { }; #ifdef CONFIG_USB +static struct device_d usbotg_dev = { + .id = -1, + .name = "ehci", + .map_base = IMX_OTG_BASE, + .size = 0x200, +}; + static struct device_d usbh2_dev = { .id = -1, .name = "ehci", @@ -73,27 +80,19 @@ static struct device_d usbh2_dev = { .size = 0x200, }; -static void pca100_usbh_init(void) +static void pca100_usb_register(void) { - uint32_t temp; - - temp = readl(IMX_OTG_BASE + 0x600); - temp &= ~((3 << 21) | 1); - temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 11) | (1 << 20); - writel(temp, IMX_OTG_BASE + 0x600); - - temp = readl(IMX_OTG_BASE + 0x584); - temp &= ~(3 << 30); - temp |= 2 << 30; - writel(temp, IMX_OTG_BASE + 0x584); - mdelay(10); gpio_direction_output(GPIO_PORTB + 24, 0); + gpio_direction_output(GPIO_PORTB + 23, 0); mdelay(10); + isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1); + register_device(&usbotg_dev); isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1); + register_device(&usbh2_dev); } #endif @@ -120,6 +119,38 @@ static void pca100_mmu_init(void) } #endif +static void pca100_usb_init(void) +{ + u32 reg; + + reg = readl(IMX_OTG_BASE + 0x600); + reg &= ~((3 << 21) | 1); + reg |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 11) | (1 << 20); + writel(reg, IMX_OTG_BASE + 0x600); + + /* + * switch usbotg and usbh2 to ulpi mode. Do this *before* + * the iomux setup to prevent funny hardware bugs from + * triggering. Also, do this even when USB support is + * disabled to give Linux USB support a good start. + */ + reg = readl(IMX_OTG_BASE + 0x584); + reg &= ~(3 << 30); + reg |= 2 << 30; + writel(reg, IMX_OTG_BASE + 0x584); + + reg = readl(IMX_OTG_BASE + 0x184); + reg &= ~(3 << 30); + reg |= 2 << 30; + writel(reg, IMX_OTG_BASE + 0x184); + + /* disable the usb phys */ + imx_gpio_mode((GPIO_PORTB | 23) | GPIO_GPIO | GPIO_IN); + gpio_direction_output(GPIO_PORTB + 23, 1); + imx_gpio_mode((GPIO_PORTB | 24) | GPIO_GPIO | GPIO_IN); + gpio_direction_output(GPIO_PORTB + 24, 1); +} + static int pca100_devices_init(void) { int i; @@ -175,15 +206,23 @@ static int pca100_devices_init(void) PB7_PF_SD2_D3, PB8_PF_SD2_CMD, PB9_PF_SD2_CLK, + PC7_PF_USBOTG_DATA5, + PC8_PF_USBOTG_DATA6, + PC9_PF_USBOTG_DATA0, + PC10_PF_USBOTG_DATA2, + PC11_PF_USBOTG_DATA1, + PC12_PF_USBOTG_DATA4, + PC13_PF_USBOTG_DATA3, + PE0_PF_USBOTG_NXT, + PE1_PF_USBOTG_STP, + PE2_PF_USBOTG_DIR, + PE24_PF_USBOTG_CLK, + PE25_PF_USBOTG_DATA7, }; PCCR0 |= PCCR0_SDHC2_EN; - /* disable the usb phys */ - imx_gpio_mode((GPIO_PORTB | 23) | GPIO_GPIO | GPIO_IN); - gpio_direction_output(GPIO_PORTB + 23, 1); - imx_gpio_mode((GPIO_PORTB | 24) | GPIO_GPIO | GPIO_IN); - gpio_direction_output(GPIO_PORTB + 24, 1); + pca100_usb_init(); /* initizalize gpios */ for (i = 0; i < ARRAY_SIZE(mode); i++) @@ -197,8 +236,7 @@ static int pca100_devices_init(void) PCCR1 |= PCCR1_PERCLK2_EN; #ifdef CONFIG_USB - pca100_usbh_init(); - register_device(&usbh2_dev); + pca100_usb_register(); #endif nand = get_device_by_name("nand0"); diff --git a/arch/arm/boards/scb9328/env/bin/init b/arch/arm/boards/scb9328/env/bin/init deleted file mode 100644 index 416669f851..0000000000 --- a/arch/arm/boards/scb9328/env/bin/init +++ /dev/null @@ -1,3 +0,0 @@ - -echo running init - diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c index 4c08c504c5..35c7fdf730 100644 --- a/arch/arm/boards/scb9328/scb9328.c +++ b/arch/arm/boards/scb9328/scb9328.c @@ -93,7 +93,7 @@ static int scb9328_devices_init(void) { register_device(&sdram_dev); register_device(&dm9000_dev); - devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0"); + devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0"); protect_file("/dev/env0", 1); diff --git a/arch/arm/configs/chumbyone_defconfig b/arch/arm/configs/chumbyone_defconfig index 45804a8d21..33d83a87c1 100644 --- a/arch/arm/configs/chumbyone_defconfig +++ b/arch/arm/configs/chumbyone_defconfig @@ -1,10 +1,15 @@ -CONFIG_ARCH_STM=y +CONFIG_ARCH_MXS=y CONFIG_MACH_CHUMBY=y CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y +CONFIG_MMU=y +CONFIG_MALLOC_SIZE=0x1000000 CONFIG_BROKEN=y CONFIG_PROMPT="chumby:" CONFIG_LONGHELP=y +CONFIG_GLOB=y +CONFIG_HUSH_FANCY_PROMPT=y +CONFIG_HUSH_GETOPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y @@ -18,14 +23,28 @@ CONFIG_CMD_EXPORT=y CONFIG_CMD_PRINTENV=y CONFIG_CMD_READLINE=y CONFIG_CMD_ECHO_E=y +CONFIG_CMD_MEMINFO=y CONFIG_CMD_MTEST=y CONFIG_CMD_MTEST_ALTERNATIVE=y CONFIG_CMD_RESET=y +CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_BMP=y CONFIG_CMD_GPIO=y +CONFIG_NET=y +CONFIG_NET_DHCP=y +CONFIG_NET_NFS=y +CONFIG_NET_PING=y +CONFIG_NET_TFTP=y +CONFIG_NET_TFTP_PUSH=y +CONFIG_NET_NETCONSOLE=y +CONFIG_NET_RESOLV=y +CONFIG_NET_USB=y +CONFIG_NET_USB_ASIX=y # CONFIG_SPI is not set +CONFIG_USB=y +CONFIG_USB_EHCI=y CONFIG_VIDEO=y CONFIG_DRIVER_VIDEO_STM=y CONFIG_MCI=y diff --git a/arch/arm/configs/eukrea_cpuimx25_defconfig b/arch/arm/configs/eukrea_cpuimx25_defconfig index bc68804d8c..7fa20422ef 100644 --- a/arch/arm/configs/eukrea_cpuimx25_defconfig +++ b/arch/arm/configs/eukrea_cpuimx25_defconfig @@ -9,10 +9,10 @@ CONFIG_LONGHELP=y CONFIG_GLOB=y CONFIG_PROMPT_HUSH_PS2="cpuimx25>" CONFIG_HUSH_FANCY_PROMPT=y -CONFIG_HUSH_GETOPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/eukrea_cpuimx25/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y @@ -22,9 +22,8 @@ CONFIG_CMD_EXPORT=y CONFIG_CMD_PRINTENV=y CONFIG_CMD_READLINE=y CONFIG_CMD_ECHO_E=y +CONFIG_CMD_LOADB=y CONFIG_CMD_MEMINFO=y -CONFIG_CMD_CRC=y -CONFIG_CMD_CRC_CMP=y CONFIG_CMD_MTEST=y CONFIG_CMD_FLASH=y CONFIG_CMD_BOOTM_ZLIB=y @@ -38,10 +37,14 @@ CONFIG_CMD_BMP=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNLZO=y CONFIG_CMD_I2C=y +CONFIG_CMD_LED=y +CONFIG_CMD_LED_TRIGGER=y CONFIG_NET=y CONFIG_NET_DHCP=y +CONFIG_NET_NFS=y CONFIG_NET_PING=y CONFIG_NET_TFTP=y +CONFIG_NET_TFTP_PUSH=y CONFIG_DRIVER_NET_FEC_IMX=y # CONFIG_SPI is not set CONFIG_I2C=y @@ -51,9 +54,11 @@ CONFIG_NAND=y CONFIG_NAND_IMX=y CONFIG_USB=y CONFIG_USB_EHCI=y -CONFIG_USB_GADGET=y CONFIG_VIDEO=y CONFIG_DRIVER_VIDEO_IMX=y CONFIG_MCI=y CONFIG_MCI_IMX_ESDHC=y CONFIG_MCI_IMX_ESDHC_PIO=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_LED_TRIGGERS=y diff --git a/arch/arm/configs/imx23evk_defconfig b/arch/arm/configs/imx23evk_defconfig index 047a7e1586..2fc6ebe993 100644 --- a/arch/arm/configs/imx23evk_defconfig +++ b/arch/arm/configs/imx23evk_defconfig @@ -1,4 +1,4 @@ -CONFIG_ARCH_STM=y +CONFIG_ARCH_MXS=y CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_BROKEN=y diff --git a/arch/arm/configs/pca100_defconfig b/arch/arm/configs/pca100_defconfig index 8c72bdf237..3450b8edb8 100644 --- a/arch/arm/configs/pca100_defconfig +++ b/arch/arm/configs/pca100_defconfig @@ -23,7 +23,6 @@ CONFIG_CMD_PRINTENV=y CONFIG_CMD_READLINE=y CONFIG_CMD_ECHO_E=y CONFIG_CMD_MEMINFO=y -CONFIG_CMD_CRC=y CONFIG_CMD_MTEST=y CONFIG_CMD_FLASH=y CONFIG_CMD_RESET=y @@ -31,6 +30,7 @@ CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_GPIO=y +CONFIG_CMD_UNLZO=y CONFIG_NET=y CONFIG_NET_DHCP=y CONFIG_NET_PING=y @@ -41,6 +41,11 @@ CONFIG_DRIVER_NET_FEC_IMX=y CONFIG_NET_USB=y CONFIG_NET_USB_ASIX=y # CONFIG_SPI is not set +CONFIG_MTD=y +CONFIG_NAND=y +CONFIG_NAND_IMX=y +CONFIG_NAND_IMX_BOOT=y +CONFIG_UBI=y CONFIG_USB=y CONFIG_USB_EHCI=y CONFIG_USB_ISP1504=y diff --git a/arch/arm/configs/scb9328_defconfig b/arch/arm/configs/scb9328_defconfig index 49bdc0d64d..ee0e2fc37b 100644 --- a/arch/arm/configs/scb9328_defconfig +++ b/arch/arm/configs/scb9328_defconfig @@ -1,11 +1,24 @@ CONFIG_ARCH_IMX=y CONFIG_MACH_SCB9328=y +CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_LONGHELP=y +CONFIG_GLOB=y +CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/scb9328/env" +CONFIG_AUTO_COMPLETE=y +CONFIG_PARTITION=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/scb9328/env/" +CONFIG_POLLER=y CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y +CONFIG_CMD_SAVEENV=y +CONFIG_CMD_LOADENV=y +CONFIG_CMD_EXPORT=y +CONFIG_CMD_PRINTENV=y +CONFIG_CMD_READLINE=y +CONFIG_CMD_ECHO_E=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_FLASH=y CONFIG_CMD_RESET=y @@ -13,10 +26,23 @@ CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_GPIO=y +CONFIG_CMD_UNLZO=y +CONFIG_CMD_LED=y +CONFIG_CMD_LED_TRIGGER=y CONFIG_NET=y CONFIG_NET_DHCP=y +CONFIG_NET_NFS=y CONFIG_NET_PING=y CONFIG_NET_TFTP=y +CONFIG_NET_TFTP_PUSH=y +CONFIG_NET_NETCONSOLE=y +CONFIG_NET_RESOLV=y CONFIG_DRIVER_NET_DM9000=y CONFIG_DRIVER_CFI=y +# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set CONFIG_CFI_BUFFER_WRITE=y +CONFIG_MTD=y +CONFIG_UBI=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_LED_TRIGGERS=y diff --git a/arch/arm/configs/tx28stk5_defconfig b/arch/arm/configs/tx28stk5_defconfig index 0851d5e242..384c1c9f3e 100644 --- a/arch/arm/configs/tx28stk5_defconfig +++ b/arch/arm/configs/tx28stk5_defconfig @@ -1,7 +1,8 @@ -CONFIG_ARCH_STM=y +CONFIG_ARCH_MXS=y CONFIG_ARCH_IMX28=y CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y +CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x800000 CONFIG_BROKEN=y CONFIG_LONGHELP=y diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig index 3572a1fe6a..8ee7d6ce27 100644 --- a/arch/arm/cpu/Kconfig +++ b/arch/arm/cpu/Kconfig @@ -73,6 +73,15 @@ config CPU_BIG_ENDIAN port must properly enable any big-endian related features of your chipset/board/processor. +config BOOT_ENDIANNESS_SWITCH + bool "Support switching of Linux kernel endianness" + help + Say Y here if you need to switch CPU endianness before running + Linux kernel, e.g. if you want big-endian Barebox to run + little-endian Linux. + + Currently implemented only by "bootz" command. + config ARCH_HAS_L2X0 bool diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 08a57ce815..df664f6f24 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -95,13 +95,7 @@ void setup_dma_coherent(unsigned long offset) void *dma_alloc_coherent(size_t size) { - void *mem; - - mem = memalign(4096, size); - if (mem) - return mem + dma_coherent_offset; - - return NULL; + return xmemalign(4096, size) + dma_coherent_offset; } unsigned long virt_to_phys(void *virt) diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index b55df5dc87..e0fb7123cf 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -25,6 +25,7 @@ #include <asm/barebox-arm.h> #include <asm/system.h> #include <asm-generic/memory_layout.h> +#include <asm/sections.h> void __naked __section(.text_entry) exception_vectors(void) { @@ -40,8 +41,6 @@ void __naked __section(.text_entry) exception_vectors(void) ); } -extern char __bss_start, _end; - /* * The actual reset vector. This code is position independent and usually * does not run at the address it's linked at. @@ -108,7 +107,7 @@ void __naked __bare_init board_init_lowlevel_return(void) (unsigned int)&__bss_start - TEXT_BASE); /* clear bss */ - memset(&__bss_start, 0, &_end - &__bss_start); + memset(__bss_start, 0, __bss_stop - __bss_start); /* call start_barebox with its absolute address */ r = (unsigned int)&start_barebox; diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index fdd23b5549..7789cc9b23 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h @@ -28,7 +28,7 @@ void *phys_to_virt(unsigned long phys); #else static inline void *dma_alloc_coherent(size_t size) { - return malloc(size); + return xmalloc(size); } static inline void dma_free_coherent(void *mem) diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h new file mode 100644 index 0000000000..2b8c516038 --- /dev/null +++ b/arch/arm/include/asm/sections.h @@ -0,0 +1 @@ +#include <asm-generic/sections.h> diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h new file mode 100644 index 0000000000..9997ad20ef --- /dev/null +++ b/arch/arm/include/asm/swab.h @@ -0,0 +1,69 @@ +/* + * arch/arm/include/asm/byteorder.h + * + * ARM Endian-ness. In little endian mode, the data bus is connected such + * that byte accesses appear as: + * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31 + * and word accesses (data or instruction) appear as: + * d0...d31 + * + * When in big endian mode, byte accesses appear as: + * 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7 + * and word accesses (data or instruction) appear as: + * d0...d31 + */ +#ifndef __ASM_ARM_SWAB_H +#define __ASM_ARM_SWAB_H + +#include <linux/compiler.h> +#include <linux/types.h> + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __SWAB_64_THRU_32__ +#endif + +#if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6 + +static inline __attribute_const__ __u16 __arch_swab16(__u16 x) +{ + __asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x)); + return x; +} +#define __arch_swab16 __arch_swab16 + +static inline __attribute_const__ __u32 __arch_swab32(__u32 x) +{ + __asm__ ("rev %0, %1" : "=r" (x) : "r" (x)); + return x; +} +#define __arch_swab32 __arch_swab32 + +#else + +static inline __attribute_const__ __u32 __arch_swab32(__u32 x) +{ + __u32 t; + +#ifndef __thumb__ + if (!__builtin_constant_p(x)) { + /* + * The compiler needs a bit of a hint here to always do the + * right thing and not screw it up to different degrees + * depending on the gcc version. + */ + asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); + } else +#endif + t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ + + x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ + t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ + x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ + + return x; +} +#define __arch_swab32 __arch_swab32 + +#endif + +#endif diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h new file mode 100644 index 0000000000..bc631161e9 --- /dev/null +++ b/arch/arm/include/asm/unified.h @@ -0,0 +1,130 @@ +/* + * include/asm-arm/unified.h - Unified Assembler Syntax helper macros + * + * Copyright (C) 2008 ARM Limited + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ASM_UNIFIED_H +#define __ASM_UNIFIED_H + +#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED) + .syntax unified +#endif + +#ifdef CONFIG_THUMB2_KERNEL + +#if __GNUC__ < 4 +#error Thumb-2 kernel requires gcc >= 4 +#endif + +/* The CPSR bit describing the instruction set (Thumb) */ +#define PSR_ISETSTATE PSR_T_BIT + +#define ARM(x...) +#define THUMB(x...) x +#ifdef __ASSEMBLY__ +#define W(instr) instr.w +#endif +#define BSYM(sym) sym + 1 + +#else /* !CONFIG_THUMB2_KERNEL */ + +/* The CPSR bit describing the instruction set (ARM) */ +#define PSR_ISETSTATE 0 + +#define ARM(x...) x +#define THUMB(x...) +#ifdef __ASSEMBLY__ +#define W(instr) instr +#endif +#define BSYM(sym) sym + +#endif /* CONFIG_THUMB2_KERNEL */ + +#ifndef CONFIG_ARM_ASM_UNIFIED + +/* + * If the unified assembly syntax isn't used (in ARM mode), these + * macros expand to an empty string + */ +#ifdef __ASSEMBLY__ + .macro it, cond + .endm + .macro itt, cond + .endm + .macro ite, cond + .endm + .macro ittt, cond + .endm + .macro itte, cond + .endm + .macro itet, cond + .endm + .macro itee, cond + .endm + .macro itttt, cond + .endm + .macro ittte, cond + .endm + .macro ittet, cond + .endm + .macro ittee, cond + .endm + .macro itett, cond + .endm + .macro itete, cond + .endm + .macro iteet, cond + .endm + .macro iteee, cond + .endm +#else /* !__ASSEMBLY__ */ +__asm__( +" .macro it, cond\n" +" .endm\n" +" .macro itt, cond\n" +" .endm\n" +" .macro ite, cond\n" +" .endm\n" +" .macro ittt, cond\n" +" .endm\n" +" .macro itte, cond\n" +" .endm\n" +" .macro itet, cond\n" +" .endm\n" +" .macro itee, cond\n" +" .endm\n" +" .macro itttt, cond\n" +" .endm\n" +" .macro ittte, cond\n" +" .endm\n" +" .macro ittet, cond\n" +" .endm\n" +" .macro ittee, cond\n" +" .endm\n" +" .macro itett, cond\n" +" .endm\n" +" .macro itete, cond\n" +" .endm\n" +" .macro iteet, cond\n" +" .endm\n" +" .macro iteee, cond\n" +" .endm\n"); +#endif /* __ASSEMBLY__ */ + +#endif /* CONFIG_ARM_ASM_UNIFIED */ + +#endif /* !__ASM_UNIFIED_H */ diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 1d7f15a489..89cb72b30f 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -1,12 +1,5 @@ obj-y += armlinux.o -obj-y += _ashldi3.o -obj-y += _ashrdi3.o obj-y += div0.o -obj-y += _divsi3.o -obj-y += _modsi3.o -obj-y += _udivsi3.o -obj-y += _umodsi3.o -obj-y += _lshrdi3.o obj-y += findbit.o obj-y += arm.o obj-y += io-readsb.o @@ -15,8 +8,10 @@ obj-y += io-readsl.o obj-y += io-writesb.o obj-y += io-writesw-armv4.o obj-y += io-writesl.o -obj-$(CONFIG_AEABI) += __aeabi_idivmod.o -obj-$(CONFIG_AEABI) += __aeabi_uidivmod.o +obj-y += lib1funcs.o +obj-y += ashrdi3.o +obj-y += ashldi3.o +obj-y += lshrdi3.o obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memcpy.o obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o diff --git a/arch/arm/lib/__aeabi_idivmod.S b/arch/arm/lib/__aeabi_idivmod.S deleted file mode 100644 index 07de06b69d..0000000000 --- a/arch/arm/lib/__aeabi_idivmod.S +++ /dev/null @@ -1,50 +0,0 @@ -/* - * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines - * - * Author: Nicolas Pitre <nico@fluxnic.net> - * - contributed to gcc-3.4 on Sep 30, 2003 - * - adapted for the Linux kernel on Oct 2, 2003 - */ - -/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -This file is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include <linux/linkage.h> -#include <asm/assembler.h> - -.section .text.__aeabi_idivmod - -ENTRY(__aeabi_idivmod) - - stmfd sp!, {r0, r1, ip, lr} - bl __aeabi_idiv - ldmfd sp!, {r1, r2, ip, lr} - mul r3, r0, r2 - sub r1, r1, r3 - mov pc, lr - -ENDPROC(__aeabi_idivmod) diff --git a/arch/arm/lib/__aeabi_uidivmod.S b/arch/arm/lib/__aeabi_uidivmod.S deleted file mode 100644 index 0e7694c3a1..0000000000 --- a/arch/arm/lib/__aeabi_uidivmod.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines - * - * Author: Nicolas Pitre <nico@fluxnic.net> - * - contributed to gcc-3.4 on Sep 30, 2003 - * - adapted for the Linux kernel on Oct 2, 2003 - */ - -/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -This file is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include <linux/linkage.h> -#include <asm/assembler.h> - -.section .text.__aeabi_uidivmod - -ENTRY(__aeabi_uidivmod) - - stmfd sp!, {r0, r1, ip, lr} - bl __aeabi_uidiv - ldmfd sp!, {r1, r2, ip, lr} - mul r3, r0, r2 - sub r1, r1, r3 - mov pc, lr - -ENDPROC(__aeabi_uidivmod) - diff --git a/arch/arm/lib/_divsi3.S b/arch/arm/lib/_divsi3.S deleted file mode 100644 index 2fbb49d588..0000000000 --- a/arch/arm/lib/_divsi3.S +++ /dev/null @@ -1,144 +0,0 @@ - -.macro ARM_DIV_BODY dividend, divisor, result, curbit - -#if __LINUX_ARM_ARCH__ >= 5 - - clz \curbit, \divisor - clz \result, \dividend - sub \result, \curbit, \result - mov \curbit, #1 - mov \divisor, \divisor, lsl \result - mov \curbit, \curbit, lsl \result - mov \result, #0 - -#else - - @ Initially shift the divisor left 3 bits if possible, - @ set curbit accordingly. This allows for curbit to be located - @ at the left end of each 4 bit nibbles in the division loop - @ to save one loop in most cases. - tst \divisor, #0xe0000000 - moveq \divisor, \divisor, lsl #3 - moveq \curbit, #8 - movne \curbit, #1 - - @ Unless the divisor is very big, shift it up in multiples of - @ four bits, since this is the amount of unwinding in the main - @ division loop. Continue shifting until the divisor is - @ larger than the dividend. -1: cmp \divisor, #0x10000000 - cmplo \divisor, \dividend - movlo \divisor, \divisor, lsl #4 - movlo \curbit, \curbit, lsl #4 - blo 1b - - @ For very big divisors, we must shift it a bit at a time, or - @ we will be in danger of overflowing. -1: cmp \divisor, #0x80000000 - cmplo \divisor, \dividend - movlo \divisor, \divisor, lsl #1 - movlo \curbit, \curbit, lsl #1 - blo 1b - - mov \result, #0 - -#endif - - @ Division loop -1: cmp \dividend, \divisor - subhs \dividend, \dividend, \divisor - orrhs \result, \result, \curbit - cmp \dividend, \divisor, lsr #1 - subhs \dividend, \dividend, \divisor, lsr #1 - orrhs \result, \result, \curbit, lsr #1 - cmp \dividend, \divisor, lsr #2 - subhs \dividend, \dividend, \divisor, lsr #2 - orrhs \result, \result, \curbit, lsr #2 - cmp \dividend, \divisor, lsr #3 - subhs \dividend, \dividend, \divisor, lsr #3 - orrhs \result, \result, \curbit, lsr #3 - cmp \dividend, #0 @ Early termination? - movnes \curbit, \curbit, lsr #4 @ No, any more bits to do? - movne \divisor, \divisor, lsr #4 - bne 1b - -.endm - -.macro ARM_DIV2_ORDER divisor, order - -#if __LINUX_ARM_ARCH__ >= 5 - - clz \order, \divisor - rsb \order, \order, #31 - -#else - - cmp \divisor, #(1 << 16) - movhs \divisor, \divisor, lsr #16 - movhs \order, #16 - movlo \order, #0 - - cmp \divisor, #(1 << 8) - movhs \divisor, \divisor, lsr #8 - addhs \order, \order, #8 - - cmp \divisor, #(1 << 4) - movhs \divisor, \divisor, lsr #4 - addhs \order, \order, #4 - - cmp \divisor, #(1 << 2) - addhi \order, \order, #3 - addls \order, \order, \divisor, lsr #1 - -#endif - -.endm - - .section .text.__divsi3 - - .align 5 -.globl __divsi3 -__divsi3: -.globl __aeabi_idiv -__aeabi_idiv: - cmp r1, #0 - eor ip, r0, r1 @ save the sign of the result. - beq Ldiv0 - rsbmi r1, r1, #0 @ loops below use unsigned. - subs r2, r1, #1 @ division by 1 or -1 ? - beq 10f - movs r3, r0 - rsbmi r3, r0, #0 @ positive dividend value - cmp r3, r1 - bls 11f - tst r1, r2 @ divisor is power of 2 ? - beq 12f - - ARM_DIV_BODY r3, r1, r0, r2 - - cmp ip, #0 - rsbmi r0, r0, #0 - mov pc, lr - -10: teq ip, r0 @ same sign ? - rsbmi r0, r0, #0 - mov pc, lr - -11: movlo r0, #0 - moveq r0, ip, asr #31 - orreq r0, r0, #1 - mov pc, lr - -12: ARM_DIV2_ORDER r1, r2 - - cmp ip, #0 - mov r0, r3, lsr r2 - rsbmi r0, r0, #0 - mov pc, lr - -Ldiv0: - - str lr, [sp, #-4]! - bl __div0 - mov r0, #0 @ About as wrong as it could be. - ldr pc, [sp], #4 diff --git a/arch/arm/lib/_modsi3.S b/arch/arm/lib/_modsi3.S deleted file mode 100644 index d17f8f0d21..0000000000 --- a/arch/arm/lib/_modsi3.S +++ /dev/null @@ -1,101 +0,0 @@ - - .section .text.__modsi3 - -.macro ARM_MOD_BODY dividend, divisor, order, spare - -#if __LINUX_ARM_ARCH__ >= 5 - - clz \order, \divisor - clz \spare, \dividend - sub \order, \order, \spare - mov \divisor, \divisor, lsl \order - -#else - - mov \order, #0 - - @ Unless the divisor is very big, shift it up in multiples of - @ four bits, since this is the amount of unwinding in the main - @ division loop. Continue shifting until the divisor is - @ larger than the dividend. -1: cmp \divisor, #0x10000000 - cmplo \divisor, \dividend - movlo \divisor, \divisor, lsl #4 - addlo \order, \order, #4 - blo 1b - - @ For very big divisors, we must shift it a bit at a time, or - @ we will be in danger of overflowing. -1: cmp \divisor, #0x80000000 - cmplo \divisor, \dividend - movlo \divisor, \divisor, lsl #1 - addlo \order, \order, #1 - blo 1b - -#endif - - @ Perform all needed substractions to keep only the reminder. - @ Do comparisons in batch of 4 first. - subs \order, \order, #3 @ yes, 3 is intended here - blt 2f - -1: cmp \dividend, \divisor - subhs \dividend, \dividend, \divisor - cmp \dividend, \divisor, lsr #1 - subhs \dividend, \dividend, \divisor, lsr #1 - cmp \dividend, \divisor, lsr #2 - subhs \dividend, \dividend, \divisor, lsr #2 - cmp \dividend, \divisor, lsr #3 - subhs \dividend, \dividend, \divisor, lsr #3 - cmp \dividend, #1 - mov \divisor, \divisor, lsr #4 - subges \order, \order, #4 - bge 1b - - tst \order, #3 - teqne \dividend, #0 - beq 5f - - @ Either 1, 2 or 3 comparison/substractions are left. -2: cmn \order, #2 - blt 4f - beq 3f - cmp \dividend, \divisor - subhs \dividend, \dividend, \divisor - mov \divisor, \divisor, lsr #1 -3: cmp \dividend, \divisor - subhs \dividend, \dividend, \divisor - mov \divisor, \divisor, lsr #1 -4: cmp \dividend, \divisor - subhs \dividend, \dividend, \divisor -5: -.endm - - .align 5 -.globl __modsi3 -__modsi3: - cmp r1, #0 - beq Ldiv0 - rsbmi r1, r1, #0 @ loops below use unsigned. - movs ip, r0 @ preserve sign of dividend - rsbmi r0, r0, #0 @ if negative make positive - subs r2, r1, #1 @ compare divisor with 1 - cmpne r0, r1 @ compare dividend with divisor - moveq r0, #0 - tsthi r1, r2 @ see if divisor is power of 2 - andeq r0, r0, r2 - bls 10f - - ARM_MOD_BODY r0, r1, r2, r3 - -10: cmp ip, #0 - rsbmi r0, r0, #0 - mov pc, lr - - -Ldiv0: - - str lr, [sp, #-4]! - bl __div0 - mov r0, #0 @ About as wrong as it could be. - ldr pc, [sp], #4 diff --git a/arch/arm/lib/_udivsi3.S b/arch/arm/lib/_udivsi3.S deleted file mode 100644 index bc89b276c4..0000000000 --- a/arch/arm/lib/_udivsi3.S +++ /dev/null @@ -1,81 +0,0 @@ -/* # 1 "libgcc1.S" */ -@ libgcc1 routines for ARM cpu. -@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk) -dividend .req r0 -divisor .req r1 -result .req r2 -curbit .req r3 -/* ip .req r12 */ -/* sp .req r13 */ -/* lr .req r14 */ -/* pc .req r15 */ - .section .text.__udivsi3 - - .globl __udivsi3 - .type __udivsi3 ,function - .globl __aeabi_uidiv - .type __aeabi_uidiv ,function - .align 0 - __udivsi3 : -__aeabi_uidiv : - cmp divisor, #0 - beq Ldiv0 - mov curbit, #1 - mov result, #0 - cmp dividend, divisor - bcc Lgot_result -Loop1: - @ Unless the divisor is very big, shift it up in multiples of - @ four bits, since this is the amount of unwinding in the main - @ division loop. Continue shifting until the divisor is - @ larger than the dividend. - cmp divisor, #0x10000000 - cmpcc divisor, dividend - movcc divisor, divisor, lsl #4 - movcc curbit, curbit, lsl #4 - bcc Loop1 -Lbignum: - @ For very big divisors, we must shift it a bit at a time, or - @ we will be in danger of overflowing. - cmp divisor, #0x80000000 - cmpcc divisor, dividend - movcc divisor, divisor, lsl #1 - movcc curbit, curbit, lsl #1 - bcc Lbignum -Loop3: - @ Test for possible subtractions, and note which bits - @ are done in the result. On the final pass, this may subtract - @ too much from the dividend, but the result will be ok, since the - @ "bit" will have been shifted out at the bottom. - cmp dividend, divisor - subcs dividend, dividend, divisor - orrcs result, result, curbit - cmp dividend, divisor, lsr #1 - subcs dividend, dividend, divisor, lsr #1 - orrcs result, result, curbit, lsr #1 - cmp dividend, divisor, lsr #2 - subcs dividend, dividend, divisor, lsr #2 - orrcs result, result, curbit, lsr #2 - cmp dividend, divisor, lsr #3 - subcs dividend, dividend, divisor, lsr #3 - orrcs result, result, curbit, lsr #3 - cmp dividend, #0 @ Early termination? - movnes curbit, curbit, lsr #4 @ No, any more bits to do? - movne divisor, divisor, lsr #4 - bne Loop3 -Lgot_result: - mov r0, result - mov pc, lr -Ldiv0: - str lr, [sp, #-4]! - bl __div0 (PLT) - mov r0, #0 @ about as wrong as it could be - ldmia sp!, {pc} - .size __udivsi3 , . - __udivsi3 -/* # 235 "libgcc1.S" */ -/* # 320 "libgcc1.S" */ -/* # 421 "libgcc1.S" */ -/* # 433 "libgcc1.S" */ -/* # 456 "libgcc1.S" */ -/* # 500 "libgcc1.S" */ -/* # 580 "libgcc1.S" */ diff --git a/arch/arm/lib/_umodsi3.S b/arch/arm/lib/_umodsi3.S deleted file mode 100644 index 58186e9ce8..0000000000 --- a/arch/arm/lib/_umodsi3.S +++ /dev/null @@ -1,89 +0,0 @@ -/* # 1 "libgcc1.S" */ -@ libgcc1 routines for ARM cpu. -@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk) -/* # 145 "libgcc1.S" */ -dividend .req r0 -divisor .req r1 -overdone .req r2 -curbit .req r3 -/* ip .req r12 */ -/* sp .req r13 */ -/* lr .req r14 */ -/* pc .req r15 */ - .section .text.__umodsi3 - - .globl __umodsi3 - .type __umodsi3 ,function - .align 0 - __umodsi3 : - cmp divisor, #0 - beq Ldiv0 - mov curbit, #1 - cmp dividend, divisor - movcc pc, lr -Loop1: - @ Unless the divisor is very big, shift it up in multiples of - @ four bits, since this is the amount of unwinding in the main - @ division loop. Continue shifting until the divisor is - @ larger than the dividend. - cmp divisor, #0x10000000 - cmpcc divisor, dividend - movcc divisor, divisor, lsl #4 - movcc curbit, curbit, lsl #4 - bcc Loop1 -Lbignum: - @ For very big divisors, we must shift it a bit at a time, or - @ we will be in danger of overflowing. - cmp divisor, #0x80000000 - cmpcc divisor, dividend - movcc divisor, divisor, lsl #1 - movcc curbit, curbit, lsl #1 - bcc Lbignum -Loop3: - @ Test for possible subtractions. On the final pass, this may - @ subtract too much from the dividend, so keep track of which - @ subtractions are done, we can fix them up afterwards... - mov overdone, #0 - cmp dividend, divisor - subcs dividend, dividend, divisor - cmp dividend, divisor, lsr #1 - subcs dividend, dividend, divisor, lsr #1 - orrcs overdone, overdone, curbit, ror #1 - cmp dividend, divisor, lsr #2 - subcs dividend, dividend, divisor, lsr #2 - orrcs overdone, overdone, curbit, ror #2 - cmp dividend, divisor, lsr #3 - subcs dividend, dividend, divisor, lsr #3 - orrcs overdone, overdone, curbit, ror #3 - mov ip, curbit - cmp dividend, #0 @ Early termination? - movnes curbit, curbit, lsr #4 @ No, any more bits to do? - movne divisor, divisor, lsr #4 - bne Loop3 - @ Any subtractions that we should not have done will be recorded in - @ the top three bits of "overdone". Exactly which were not needed - @ are governed by the position of the bit, stored in ip. - @ If we terminated early, because dividend became zero, - @ then none of the below will match, since the bit in ip will not be - @ in the bottom nibble. - ands overdone, overdone, #0xe0000000 - moveq pc, lr @ No fixups needed - tst overdone, ip, ror #3 - addne dividend, dividend, divisor, lsr #3 - tst overdone, ip, ror #2 - addne dividend, dividend, divisor, lsr #2 - tst overdone, ip, ror #1 - addne dividend, dividend, divisor, lsr #1 - mov pc, lr -Ldiv0: - str lr, [sp, #-4]! - bl __div0 (PLT) - mov r0, #0 @ about as wrong as it could be - ldmia sp!, {pc} - .size __umodsi3 , . - __umodsi3 -/* # 320 "libgcc1.S" */ -/* # 421 "libgcc1.S" */ -/* # 433 "libgcc1.S" */ -/* # 456 "libgcc1.S" */ -/* # 500 "libgcc1.S" */ -/* # 580 "libgcc1.S" */ diff --git a/arch/arm/lib/arm.c b/arch/arm/lib/arm.c index 8ac9ff4ae4..6549118b83 100644 --- a/arch/arm/lib/arm.c +++ b/arch/arm/lib/arm.c @@ -3,7 +3,6 @@ #include <mem_malloc.h> #include <asm/barebox-arm.h> #include <asm-generic/memory_layout.h> -#include <reloc.h> static int arm_mem_malloc_init(void) { diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index f826da64cb..9927b766d9 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -41,6 +41,7 @@ #include <asm/setup.h> #include <asm/barebox-arm.h> #include <asm/armlinux.h> +#include <asm/system.h> static struct tag *params; static int armlinux_architecture = 0; @@ -85,9 +86,10 @@ static void setup_memory_tags(void) } } -static void setup_commandline_tag(const char *commandline) +static void setup_commandline_tag(const char *commandline, int swap) { const char *p; + size_t words; if (!commandline) return; @@ -102,12 +104,20 @@ static void setup_commandline_tag(const char *commandline) if (*p == '\0') return; + words = (strlen(p) + 1 /* NUL */ + 3 /* round up */) >> 2; params->hdr.tag = ATAG_CMDLINE; - params->hdr.size = - (sizeof (struct tag_header) + strlen(p) + 1 + 4) >> 2; + params->hdr.size = (sizeof(struct tag_header) >> 2) + words; strcpy(params->u.cmdline.cmdline, p); +#ifdef CONFIG_BOOT_ENDIANNESS_SWITCH + if (swap) { + u32 *cmd = (u32 *)params->u.cmdline.cmdline; + while (words--) + cmd[words] = swab32(cmd[words]); + } +#endif + params = tag_next(params); } @@ -156,13 +166,13 @@ static void setup_end_tag (void) params->hdr.size = 0; } -static void setup_tags(struct image_data *data) +static void setup_tags(struct image_data *data, int swap) { const char *commandline = getenv("bootargs"); setup_start_tag(); setup_memory_tags(); - setup_commandline_tag(commandline); + setup_commandline_tag(commandline, swap); if (data && data->initrd) setup_initrd_tag (&data->initrd->header); @@ -231,7 +241,7 @@ static int do_bootm_linux(struct image_data *data) debug("## Transferring control to Linux (at address 0x%p) ...\n", theKernel); - setup_tags(data); + setup_tags(data, 0); if (relocate_image(data->os, (void *)image_get_load(os_header))) return -1; @@ -290,18 +300,21 @@ late_initcall(armlinux_register_image_handler); #ifdef CONFIG_CMD_BOOTZ struct zimage_header { - u32 unsused[9]; + u32 unused[9]; u32 magic; u32 start; u32 end; }; +#define ZIMAGE_MAGIC 0x016F2818 + static int do_bootz(struct command *cmdtp, int argc, char *argv[]) { void (*theKernel)(int zero, int arch, void *params); - int fd, ret; + int fd, ret, swap = 0; struct zimage_header header; void *zimage; + u32 end; if (argc != 2) { barebox_cmd_usage(cmdtp); @@ -320,27 +333,53 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[]) goto err_out; } - if (header.magic != 0x016f2818) { + switch (header.magic) { +#ifdef CONFIG_BOOT_ENDIANNESS_SWITCH + case swab32(ZIMAGE_MAGIC): + swap = 1; + /* fall through */ +#endif + case ZIMAGE_MAGIC: + break; + default: printf("invalid magic 0x%08x\n", header.magic); goto err_out; } - zimage = xmalloc(header.end); + end = header.end; + + if (swap) + end = swab32(end); + + zimage = xmalloc(end); memcpy(zimage, &header, sizeof(header)); - ret = read(fd, zimage + sizeof(header), header.end - sizeof(header)); - if (ret < header.end - sizeof(header)) { + ret = read(fd, zimage + sizeof(header), end - sizeof(header)); + if (ret < end - sizeof(header)) { printf("could not read %s\n", argv[1]); goto err_out1; } + if (swap) { + void *ptr; + for (ptr = zimage; ptr < zimage + end; ptr += 4) + *(u32 *)ptr = swab32(*(u32 *)ptr); + } + theKernel = zimage; - printf("loaded zImage from %s with size %d\n", argv[1], header.end); + printf("loaded zImage from %s with size %d\n", argv[1], end); - setup_tags(NULL); + setup_tags(NULL, swap); shutdown_barebox(); + if (swap) { + u32 reg; + __asm__ __volatile__("mrc p15, 0, %0, c1, c0" : "=r" (reg)); + reg ^= CR_B; /* swap big-endian flag */ + __asm__ __volatile__("mcr p15, 0, %0, c1, c0" :: "r" (reg)); + } + theKernel(0, armlinux_architecture, armlinux_bootparams); return 0; @@ -382,7 +421,7 @@ static int do_bootu(struct command *cmdtp, int argc, char *argv[]) if (!theKernel) theKernel = (void *)simple_strtoul(argv[1], NULL, 0); - setup_tags(NULL); + setup_tags(NULL, 0); shutdown_barebox(); theKernel(0, armlinux_architecture, armlinux_bootparams); diff --git a/arch/arm/lib/_ashldi3.S b/arch/arm/lib/ashldi3.S index e1c1bf3a50..638deb13da 100644 --- a/arch/arm/lib/_ashldi3.S +++ b/arch/arm/lib/ashldi3.S @@ -26,6 +26,8 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include <linux/linkage.h> + #ifdef __ARMEB__ #define al r1 #define ah r0 @@ -34,17 +36,18 @@ Boston, MA 02110-1301, USA. */ #define ah r1 #endif - .section .text.__ashldi3 - -.globl __ashldi3 -__ashldi3: -.globl __aeabi_llsl -__aeabi_llsl: +ENTRY(__ashldi3) +ENTRY(__aeabi_llsl) subs r3, r2, #32 rsb ip, r2, #32 movmi ah, ah, lsl r2 movpl ah, al, lsl r3 - orrmi ah, ah, al, lsr ip + ARM( orrmi ah, ah, al, lsr ip ) + THUMB( lsrmi r3, al, ip ) + THUMB( orrmi ah, ah, r3 ) mov al, al, lsl r2 mov pc, lr + +ENDPROC(__ashldi3) +ENDPROC(__aeabi_llsl) diff --git a/arch/arm/lib/_ashrdi3.S b/arch/arm/lib/ashrdi3.S index e6315547da..015e8aa5a1 100644 --- a/arch/arm/lib/_ashrdi3.S +++ b/arch/arm/lib/ashrdi3.S @@ -26,6 +26,8 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include <linux/linkage.h> + #ifdef __ARMEB__ #define al r1 #define ah r0 @@ -34,17 +36,18 @@ Boston, MA 02110-1301, USA. */ #define ah r1 #endif - .section .text.__ashrdi3 - -.globl __ashrdi3 -__ashrdi3: -.globl __aeabi_lasr -__aeabi_lasr: +ENTRY(__ashrdi3) +ENTRY(__aeabi_lasr) subs r3, r2, #32 rsb ip, r2, #32 movmi al, al, lsr r2 movpl al, ah, asr r3 - orrmi al, al, ah, lsl ip + ARM( orrmi al, al, ah, lsl ip ) + THUMB( lslmi r3, ah, ip ) + THUMB( orrmi al, al, r3 ) mov ah, ah, asr r2 mov pc, lr + +ENDPROC(__ashrdi3) +ENDPROC(__aeabi_lasr) diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index 5bee0a17f8..cc74b2f07d 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -75,5 +75,6 @@ SECTIONS . = ALIGN(4); __bss_start = .; .bss : { *(.bss*) } + __bss_stop = .; _end = .; } diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S new file mode 100644 index 0000000000..5143e90130 --- /dev/null +++ b/arch/arm/lib/lib1funcs.S @@ -0,0 +1,348 @@ +/* + * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines + * + * Author: Nicolas Pitre <nico@fluxnic.net> + * - contributed to gcc-3.4 on Sep 30, 2003 + * - adapted for the Linux kernel on Oct 2, 2003 + */ + +/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. + +This file is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +This file is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#include <linux/linkage.h> +#include <asm/assembler.h> + + +.macro ARM_DIV_BODY dividend, divisor, result, curbit + +#if __LINUX_ARM_ARCH__ >= 5 + + clz \curbit, \divisor + clz \result, \dividend + sub \result, \curbit, \result + mov \curbit, #1 + mov \divisor, \divisor, lsl \result + mov \curbit, \curbit, lsl \result + mov \result, #0 + +#else + + @ Initially shift the divisor left 3 bits if possible, + @ set curbit accordingly. This allows for curbit to be located + @ at the left end of each 4 bit nibbles in the division loop + @ to save one loop in most cases. + tst \divisor, #0xe0000000 + moveq \divisor, \divisor, lsl #3 + moveq \curbit, #8 + movne \curbit, #1 + + @ Unless the divisor is very big, shift it up in multiples of + @ four bits, since this is the amount of unwinding in the main + @ division loop. Continue shifting until the divisor is + @ larger than the dividend. +1: cmp \divisor, #0x10000000 + cmplo \divisor, \dividend + movlo \divisor, \divisor, lsl #4 + movlo \curbit, \curbit, lsl #4 + blo 1b + + @ For very big divisors, we must shift it a bit at a time, or + @ we will be in danger of overflowing. +1: cmp \divisor, #0x80000000 + cmplo \divisor, \dividend + movlo \divisor, \divisor, lsl #1 + movlo \curbit, \curbit, lsl #1 + blo 1b + + mov \result, #0 + +#endif + + @ Division loop +1: cmp \dividend, \divisor + subhs \dividend, \dividend, \divisor + orrhs \result, \result, \curbit + cmp \dividend, \divisor, lsr #1 + subhs \dividend, \dividend, \divisor, lsr #1 + orrhs \result, \result, \curbit, lsr #1 + cmp \dividend, \divisor, lsr #2 + subhs \dividend, \dividend, \divisor, lsr #2 + orrhs \result, \result, \curbit, lsr #2 + cmp \dividend, \divisor, lsr #3 + subhs \dividend, \dividend, \divisor, lsr #3 + orrhs \result, \result, \curbit, lsr #3 + cmp \dividend, #0 @ Early termination? + movnes \curbit, \curbit, lsr #4 @ No, any more bits to do? + movne \divisor, \divisor, lsr #4 + bne 1b + +.endm + + +.macro ARM_DIV2_ORDER divisor, order + +#if __LINUX_ARM_ARCH__ >= 5 + + clz \order, \divisor + rsb \order, \order, #31 + +#else + + cmp \divisor, #(1 << 16) + movhs \divisor, \divisor, lsr #16 + movhs \order, #16 + movlo \order, #0 + + cmp \divisor, #(1 << 8) + movhs \divisor, \divisor, lsr #8 + addhs \order, \order, #8 + + cmp \divisor, #(1 << 4) + movhs \divisor, \divisor, lsr #4 + addhs \order, \order, #4 + + cmp \divisor, #(1 << 2) + addhi \order, \order, #3 + addls \order, \order, \divisor, lsr #1 + +#endif + +.endm + + +.macro ARM_MOD_BODY dividend, divisor, order, spare + +#if __LINUX_ARM_ARCH__ >= 5 + + clz \order, \divisor + clz \spare, \dividend + sub \order, \order, \spare + mov \divisor, \divisor, lsl \order + +#else + + mov \order, #0 + + @ Unless the divisor is very big, shift it up in multiples of + @ four bits, since this is the amount of unwinding in the main + @ division loop. Continue shifting until the divisor is + @ larger than the dividend. +1: cmp \divisor, #0x10000000 + cmplo \divisor, \dividend + movlo \divisor, \divisor, lsl #4 + addlo \order, \order, #4 + blo 1b + + @ For very big divisors, we must shift it a bit at a time, or + @ we will be in danger of overflowing. +1: cmp \divisor, #0x80000000 + cmplo \divisor, \dividend + movlo \divisor, \divisor, lsl #1 + addlo \order, \order, #1 + blo 1b + +#endif + + @ Perform all needed substractions to keep only the reminder. + @ Do comparisons in batch of 4 first. + subs \order, \order, #3 @ yes, 3 is intended here + blt 2f + +1: cmp \dividend, \divisor + subhs \dividend, \dividend, \divisor + cmp \dividend, \divisor, lsr #1 + subhs \dividend, \dividend, \divisor, lsr #1 + cmp \dividend, \divisor, lsr #2 + subhs \dividend, \dividend, \divisor, lsr #2 + cmp \dividend, \divisor, lsr #3 + subhs \dividend, \dividend, \divisor, lsr #3 + cmp \dividend, #1 + mov \divisor, \divisor, lsr #4 + subges \order, \order, #4 + bge 1b + + tst \order, #3 + teqne \dividend, #0 + beq 5f + + @ Either 1, 2 or 3 comparison/substractions are left. +2: cmn \order, #2 + blt 4f + beq 3f + cmp \dividend, \divisor + subhs \dividend, \dividend, \divisor + mov \divisor, \divisor, lsr #1 +3: cmp \dividend, \divisor + subhs \dividend, \dividend, \divisor + mov \divisor, \divisor, lsr #1 +4: cmp \dividend, \divisor + subhs \dividend, \dividend, \divisor +5: +.endm + + +ENTRY(__udivsi3) +ENTRY(__aeabi_uidiv) + + subs r2, r1, #1 + moveq pc, lr + bcc Ldiv0 + cmp r0, r1 + bls 11f + tst r1, r2 + beq 12f + + ARM_DIV_BODY r0, r1, r2, r3 + + mov r0, r2 + mov pc, lr + +11: moveq r0, #1 + movne r0, #0 + mov pc, lr + +12: ARM_DIV2_ORDER r1, r2 + + mov r0, r0, lsr r2 + mov pc, lr + +ENDPROC(__udivsi3) +ENDPROC(__aeabi_uidiv) + +ENTRY(__umodsi3) + + subs r2, r1, #1 @ compare divisor with 1 + bcc Ldiv0 + cmpne r0, r1 @ compare dividend with divisor + moveq r0, #0 + tsthi r1, r2 @ see if divisor is power of 2 + andeq r0, r0, r2 + movls pc, lr + + ARM_MOD_BODY r0, r1, r2, r3 + + mov pc, lr + +ENDPROC(__umodsi3) + +ENTRY(__divsi3) +ENTRY(__aeabi_idiv) + + cmp r1, #0 + eor ip, r0, r1 @ save the sign of the result. + beq Ldiv0 + rsbmi r1, r1, #0 @ loops below use unsigned. + subs r2, r1, #1 @ division by 1 or -1 ? + beq 10f + movs r3, r0 + rsbmi r3, r0, #0 @ positive dividend value + cmp r3, r1 + bls 11f + tst r1, r2 @ divisor is power of 2 ? + beq 12f + + ARM_DIV_BODY r3, r1, r0, r2 + + cmp ip, #0 + rsbmi r0, r0, #0 + mov pc, lr + +10: teq ip, r0 @ same sign ? + rsbmi r0, r0, #0 + mov pc, lr + +11: movlo r0, #0 + moveq r0, ip, asr #31 + orreq r0, r0, #1 + mov pc, lr + +12: ARM_DIV2_ORDER r1, r2 + + cmp ip, #0 + mov r0, r3, lsr r2 + rsbmi r0, r0, #0 + mov pc, lr + +ENDPROC(__divsi3) +ENDPROC(__aeabi_idiv) + +ENTRY(__modsi3) + + cmp r1, #0 + beq Ldiv0 + rsbmi r1, r1, #0 @ loops below use unsigned. + movs ip, r0 @ preserve sign of dividend + rsbmi r0, r0, #0 @ if negative make positive + subs r2, r1, #1 @ compare divisor with 1 + cmpne r0, r1 @ compare dividend with divisor + moveq r0, #0 + tsthi r1, r2 @ see if divisor is power of 2 + andeq r0, r0, r2 + bls 10f + + ARM_MOD_BODY r0, r1, r2, r3 + +10: cmp ip, #0 + rsbmi r0, r0, #0 + mov pc, lr + +ENDPROC(__modsi3) + +#ifdef CONFIG_AEABI + +ENTRY(__aeabi_uidivmod) + + stmfd sp!, {r0, r1, ip, lr} + bl __aeabi_uidiv + ldmfd sp!, {r1, r2, ip, lr} + mul r3, r0, r2 + sub r1, r1, r3 + mov pc, lr + +ENDPROC(__aeabi_uidivmod) + +ENTRY(__aeabi_idivmod) + + stmfd sp!, {r0, r1, ip, lr} + bl __aeabi_idiv + ldmfd sp!, {r1, r2, ip, lr} + mul r3, r0, r2 + sub r1, r1, r3 + mov pc, lr + +ENDPROC(__aeabi_idivmod) + +#endif + +Ldiv0: + + str lr, [sp, #-8]! + bl __div0 + mov r0, #0 @ About as wrong as it could be. + ldr pc, [sp], #8 + + diff --git a/arch/arm/lib/_lshrdi3.S b/arch/arm/lib/lshrdi3.S index 71e7f3e3d5..f83d449141 100644 --- a/arch/arm/lib/_lshrdi3.S +++ b/arch/arm/lib/lshrdi3.S @@ -25,6 +25,9 @@ along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include <linux/linkage.h> + #ifdef __ARMEB__ #define al r1 #define ah r0 @@ -32,18 +35,19 @@ Boston, MA 02110-1301, USA. */ #define al r0 #define ah r1 #endif - .section .text.__lshrdi3 -.globl __lshrdi3 -__lshrdi3: -.globl __aeabi_llsr -__aeabi_llsr: +ENTRY(__lshrdi3) +ENTRY(__aeabi_llsr) subs r3, r2, #32 rsb ip, r2, #32 movmi al, al, lsr r2 movpl al, ah, lsr r3 - orrmi al, al, ah, lsl ip + ARM( orrmi al, al, ah, lsl ip ) + THUMB( lslmi r3, ah, ip ) + THUMB( orrmi al, al, r3 ) mov ah, ah, lsr r2 mov pc, lr +ENDPROC(__lshrdi3) +ENDPROC(__aeabi_llsr) diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 8795293092..5df852667a 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -175,7 +175,8 @@ config MACH_AT91SAM9M10G45EK bool "Atmel AT91SAM9M10G45-EK Evaluation Kit" select HAVE_NAND_ATMEL_BUSWIDTH_16 help - Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit. + Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit + or AT91SAM9G45-EKES or AT91SAM9M10-EKES (for those 2 select the LG LCD) <http://atmel.com/dyn/products/tools_card_v2.asp?tool_id=4735> config MACH_PM9G45 @@ -206,4 +207,20 @@ config AT91_HAVE_2MMC with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and onwards. +choice + prompt "LCD type" + depends on MACH_AT91SAM9M10G45EK + +config LCD_TRULY_TFT1N4633E + bool "truly TFT1N4633-E" + help + Found on AT91SAM9M10G45-EK + +config LCD_LG_LB043WQ1 + bool "LG philips LB043WQ1" + help + Found on AT91SAM9G45-EKES and AT91SAM9M10-EKES + +endchoice + endif diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index d000683863..3b2deafb2e 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_NAND_IMX) += nand.o obj-y += speed.o obj-y += devices.o +obj-y += boot.o diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c new file mode 100644 index 0000000000..b4bf93bc35 --- /dev/null +++ b/arch/arm/mach-imx/boot.c @@ -0,0 +1,95 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <environment.h> +#include <init.h> + +#include <asm/io.h> +#include <mach/imx-regs.h> + +#if defined(CONFIG_ARCH_IMX25) || defined(CONFIG_ARCH_IMX35) +/* + * Saves the boot source media into the $barebox_loc enviroment variable + * + * This information is useful for barebox init scripts as we can then easily + * use a kernel image stored on the same media that we launch barebox with + * (for example). + * + * imx25 and imx35 can boot into barebox from several media such as + * nand, nor, mmc/sd cards, serial roms. "mmc" is used to represent several + * sources as its impossible to distinguish between them. + * + * Some sources such as serial roms can themselves have 3 different boot + * possibilities (i2c1, i2c2 etc). It is assumed that any board will + * only be using one of these at any one time. + * + * Note also that I suspect that the boot source pins are only sampled at + * power up. + */ +static int imx_boot_save_loc(void) +{ + const char *bareboxloc = NULL; + uint32_t reg; + unsigned int ctrl, type; + + /* [CTRL][TYPE] */ + const char *const locations[4][4] = { + { /* CTRL = WEIM */ + "nor", + NULL, + "onenand", + NULL, + }, { /* CTRL == NAND */ + "nand", + "nand", + "nand", + "nand", + }, { /* CTRL == ATA, (imx35 only) */ + NULL, + NULL, /* might be p-ata */ + NULL, + NULL, + }, { /* CTRL == expansion */ + "mmc", /* note imx25 could also be: movinand, ce-ata */ + NULL, + "i2c", + "spi", + } + }; + + reg = readl(IMX_CCM_BASE + CCM_RCSR); + ctrl = (reg >> CCM_RCSR_MEM_CTRL_SHIFT) & 0x3; + type = (reg >> CCM_RCSR_MEM_TYPE_SHIFT) & 0x3; + + bareboxloc = locations[ctrl][type]; + + if (bareboxloc) { + setenv("barebox_loc", bareboxloc); + export("barebox_loc"); + } + + return 0; +} + +/* + * This can only be called after env_push_context() has been called + * so it is a late_initcall. + */ +late_initcall(imx_boot_save_loc); + +#endif diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h index ac590d9a0e..78ec0cdbf1 100644 --- a/arch/arm/mach-imx/include/mach/imx25-regs.h +++ b/arch/arm/mach-imx/include/mach/imx25-regs.h @@ -79,6 +79,9 @@ #define PDR0_AUTO_CON (1 << 0) #define PDR0_PER_SEL (1 << 26) +#define CCM_RCSR_MEM_CTRL_SHIFT 30 +#define CCM_RCSR_MEM_TYPE_SHIFT 28 + /* * Adresses and ranges of the external chip select lines */ diff --git a/arch/arm/mach-imx/include/mach/imx35-regs.h b/arch/arm/mach-imx/include/mach/imx35-regs.h index 75825e50df..280d075c87 100644 --- a/arch/arm/mach-imx/include/mach/imx35-regs.h +++ b/arch/arm/mach-imx/include/mach/imx35-regs.h @@ -79,6 +79,9 @@ #define CCM_CGR1_SDHC1_SHIFT 26 #define CCM_CGR2_USB_SHIFT 22 +#define CCM_RCSR_MEM_CTRL_SHIFT 25 +#define CCM_RCSR_MEM_TYPE_SHIFT 23 + #define PDR0_AUTO_MUX_DIV(x) (((x) & 0x7) << 9) #define PDR0_CCM_PER_AHB(x) (((x) & 0x7) << 12) #define PDR0_CON_MUX_DIV(x) (((x) & 0xf) << 16) diff --git a/arch/arm/mach-stm/Kconfig b/arch/arm/mach-mxs/Kconfig index e47d9f12a8..f9cefaf907 100644 --- a/arch/arm/mach-stm/Kconfig +++ b/arch/arm/mach-mxs/Kconfig @@ -1,4 +1,4 @@ -if ARCH_STM +if ARCH_MXS config ARCH_TEXT_BASE hex @@ -11,7 +11,7 @@ config BOARDINFO default "Chumby Falconwing" if MACH_CHUMBY default "Karo TX28" if MACH_TX28 -comment "SigmaTel/Freescale i.MX System-on-Chip" +comment "Freescale i.MX System-on-Chip" choice prompt "Freescale i.MX Processor" @@ -55,6 +55,7 @@ choice config MACH_TX28 bool "KARO tx28" + select HAVE_MMU help Say Y here if you are using the KARO TX28 CPU module. diff --git a/arch/arm/mach-stm/Makefile b/arch/arm/mach-mxs/Makefile index 0ff8fd16d6..f70a9944cf 100644 --- a/arch/arm/mach-stm/Makefile +++ b/arch/arm/mach-mxs/Makefile @@ -1,4 +1,4 @@ obj-y += imx.o iomux-imx.o reset-imx.o obj-$(CONFIG_DRIVER_VIDEO_STM) += imx_lcd_clk.o -obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o +obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o diff --git a/arch/arm/mach-stm/clocksource-imx23.c b/arch/arm/mach-mxs/clocksource-imx23.c index f7c94c1d75..f7c94c1d75 100644 --- a/arch/arm/mach-stm/clocksource-imx23.c +++ b/arch/arm/mach-mxs/clocksource-imx23.c diff --git a/arch/arm/mach-stm/clocksource-imx28.c b/arch/arm/mach-mxs/clocksource-imx28.c index 15ae951004..15ae951004 100644 --- a/arch/arm/mach-stm/clocksource-imx28.c +++ b/arch/arm/mach-mxs/clocksource-imx28.c diff --git a/arch/arm/mach-stm/imx.c b/arch/arm/mach-mxs/imx.c index 14a4249893..14a4249893 100644 --- a/arch/arm/mach-stm/imx.c +++ b/arch/arm/mach-mxs/imx.c diff --git a/arch/arm/mach-stm/imx_lcd_clk.c b/arch/arm/mach-mxs/imx_lcd_clk.c index 89386640ad..65bfc6ee3d 100644 --- a/arch/arm/mach-stm/imx_lcd_clk.c +++ b/arch/arm/mach-mxs/imx_lcd_clk.c @@ -120,7 +120,8 @@ unsigned imx_set_lcdifclk(unsigned nc) best_frac, best_div, 480 * 18 / best_frac, 480000 * 18 / best_frac / best_div); - reg = readl(IMX_CCM_BASE + HW_CLKCTRL_FRAC) & ~MASK_PIXFRAC; + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_FRAC); + reg &= ~SET_PIXFRAC(MASK_PIXFRAC); reg |= SET_PIXFRAC(best_frac); writel(reg, IMX_CCM_BASE + HW_CLKCTRL_FRAC); writel(reg & ~CLKCTRL_FRAC_CLKGATEPIX, IMX_CCM_BASE + HW_CLKCTRL_FRAC); diff --git a/arch/arm/mach-stm/include/mach/clock-imx23.h b/arch/arm/mach-mxs/include/mach/clock-imx23.h index 723f343566..723f343566 100644 --- a/arch/arm/mach-stm/include/mach/clock-imx23.h +++ b/arch/arm/mach-mxs/include/mach/clock-imx23.h diff --git a/arch/arm/mach-stm/include/mach/clock-imx28.h b/arch/arm/mach-mxs/include/mach/clock-imx28.h index 45fb043ac4..45fb043ac4 100644 --- a/arch/arm/mach-stm/include/mach/clock-imx28.h +++ b/arch/arm/mach-mxs/include/mach/clock-imx28.h diff --git a/arch/arm/mach-stm/include/mach/clock.h b/arch/arm/mach-mxs/include/mach/clock.h index bd1fa7c849..bd1fa7c849 100644 --- a/arch/arm/mach-stm/include/mach/clock.h +++ b/arch/arm/mach-mxs/include/mach/clock.h diff --git a/arch/arm/mach-stm/include/mach/fb.h b/arch/arm/mach-mxs/include/mach/fb.h index 65e3be226b..2b6825f7b5 100644 --- a/arch/arm/mach-stm/include/mach/fb.h +++ b/arch/arm/mach-mxs/include/mach/fb.h @@ -31,12 +31,21 @@ /** swap RGB to BGR */ #define FB_SYNC_SWAP_RGB (1 << 31) -struct imx_fb_videomode { +#define USE_LCD_RESET 1 + +struct imx_fb_platformdata { struct fb_videomode *mode_list; unsigned mode_cnt; unsigned dotclk_delay; /**< refer manual HW_LCDIF_VDCTRL4 register */ unsigned ld_intf_width; /**< refer STMLCDIF_* macros */ + unsigned bits_per_pixel; + + void *fixed_screen; /**< if != NULL use this as framebuffer memory */ + unsigned fixed_screen_size; /**< framebuffer memory size for fixed_screen */ + + unsigned flags; + void (*enable)(int enable); /**< hook to enable backlight */ }; #endif /* __MACH_FB_H */ diff --git a/arch/arm/mach-stm/include/mach/generic.h b/arch/arm/mach-mxs/include/mach/generic.h index 50f25c5d1b..50f25c5d1b 100644 --- a/arch/arm/mach-stm/include/mach/generic.h +++ b/arch/arm/mach-mxs/include/mach/generic.h diff --git a/arch/arm/mach-stm/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h index c419926214..c419926214 100644 --- a/arch/arm/mach-stm/include/mach/gpio.h +++ b/arch/arm/mach-mxs/include/mach/gpio.h diff --git a/arch/arm/mach-stm/include/mach/imx-regs.h b/arch/arm/mach-mxs/include/mach/imx-regs.h index 9b33a0656c..9b33a0656c 100644 --- a/arch/arm/mach-stm/include/mach/imx-regs.h +++ b/arch/arm/mach-mxs/include/mach/imx-regs.h diff --git a/arch/arm/mach-stm/include/mach/imx23-regs.h b/arch/arm/mach-mxs/include/mach/imx23-regs.h index caac19bc01..cc8c03e8bb 100644 --- a/arch/arm/mach-stm/include/mach/imx23-regs.h +++ b/arch/arm/mach-mxs/include/mach/imx23-regs.h @@ -38,5 +38,9 @@ #define IMX_SSP1_BASE 0x80010000 #define IMX_FB_BASE 0x80030000 #define IMX_SSP2_BASE 0x80034000 +#define IMX_POWER_BASE 0x80044000 +#define IMX_USBPHY_BASE 0x8007c000 +#define IMX_DIGCTL_BASE 0x8001c000 +#define IMX_USB_BASE 0x80080000 #endif /* __ASM_ARCH_MX23_REGS_H */ diff --git a/arch/arm/mach-stm/include/mach/imx28-regs.h b/arch/arm/mach-mxs/include/mach/imx28-regs.h index 0c97c4c2f2..0c97c4c2f2 100644 --- a/arch/arm/mach-stm/include/mach/imx28-regs.h +++ b/arch/arm/mach-mxs/include/mach/imx28-regs.h diff --git a/arch/arm/mach-stm/include/mach/iomux-imx23.h b/arch/arm/mach-mxs/include/mach/iomux-imx23.h index bebaf56571..bebaf56571 100644 --- a/arch/arm/mach-stm/include/mach/iomux-imx23.h +++ b/arch/arm/mach-mxs/include/mach/iomux-imx23.h diff --git a/arch/arm/mach-stm/include/mach/iomux-imx28.h b/arch/arm/mach-mxs/include/mach/iomux-imx28.h index 1e6d421c22..1e6d421c22 100644 --- a/arch/arm/mach-stm/include/mach/iomux-imx28.h +++ b/arch/arm/mach-mxs/include/mach/iomux-imx28.h diff --git a/arch/arm/mach-stm/include/mach/mci.h b/arch/arm/mach-mxs/include/mach/mci.h index b9249085ae..b9249085ae 100644 --- a/arch/arm/mach-stm/include/mach/mci.h +++ b/arch/arm/mach-mxs/include/mach/mci.h diff --git a/arch/arm/mach-mxs/include/mach/usb.h b/arch/arm/mach-mxs/include/mach/usb.h new file mode 100644 index 0000000000..af7d885cb3 --- /dev/null +++ b/arch/arm/mach-mxs/include/mach/usb.h @@ -0,0 +1,6 @@ +#ifndef __MACH_USB_H +#define __MACH_USB_H + +int imx_usb_phy_enable(void); + +#endif /* __MACH_USB_H */ diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-mxs/iomux-imx.c index bf6165f8d2..bf6165f8d2 100644 --- a/arch/arm/mach-stm/iomux-imx.c +++ b/arch/arm/mach-mxs/iomux-imx.c diff --git a/arch/arm/mach-stm/reset-imx.c b/arch/arm/mach-mxs/reset-imx.c index b35f796b40..b35f796b40 100644 --- a/arch/arm/mach-stm/reset-imx.c +++ b/arch/arm/mach-mxs/reset-imx.c diff --git a/arch/arm/mach-stm/speed-imx23.c b/arch/arm/mach-mxs/speed-imx23.c index a31139d7a7..a31139d7a7 100644 --- a/arch/arm/mach-stm/speed-imx23.c +++ b/arch/arm/mach-mxs/speed-imx23.c diff --git a/arch/arm/mach-stm/speed-imx28.c b/arch/arm/mach-mxs/speed-imx28.c index 63c6b0754b..63c6b0754b 100644 --- a/arch/arm/mach-stm/speed-imx28.c +++ b/arch/arm/mach-mxs/speed-imx28.c diff --git a/arch/arm/mach-mxs/usb.c b/arch/arm/mach-mxs/usb.c new file mode 100644 index 0000000000..d232bb6075 --- /dev/null +++ b/arch/arm/mach-mxs/usb.c @@ -0,0 +1,92 @@ +/* + * i.MX23/28 USBPHY setup + * + * Copyright 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <common.h> +#include <asm/io.h> +#include <mach/imx-regs.h> + +#define POWER_CTRL (IMX_POWER_BASE + 0x0) +#define POWER_CTRL_CLKGATE 0x40000000 + +#define POWER_STS (IMX_POWER_BASE + 0xc0) +#define POWER_STS_VBUSVALID 0x00000002 +#define POWER_STS_BVALID 0x00000004 +#define POWER_STS_AVALID 0x00000008 + +#define POWER_DEBUG (IMX_POWER_BASE + 0x110) +#define POWER_DEBUG_BVALIDPIOLOCK 0x00000002 +#define POWER_DEBUG_AVALIDPIOLOCK 0x00000004 +#define POWER_DEBUG_VBUSVALIDPIOLOCK 0x00000008 + +#define USBPHY_PWD (IMX_USBPHY_BASE + 0x0) + +#define USBPHY_CTRL (IMX_USBPHY_BASE + 0x30) +#define USBPHY_CTRL_SFTRST 0x80000000 +#define USBPHY_CTRL_CLKGATE 0x40000000 + +#define CLK_PLLCTRL0 (IMX_CCM_BASE + 0x0) +#define PLLCTRL0_EN_USB_CLKS 0x00040000 + +#define DIGCTRL_CTRL (IMX_DIGCTL_BASE + 0x0) +#define DIGCTL_CTRL_USB_CLKGATE 0x00000004 + +#define SET 0x4 +#define CLR 0x8 + +int imx_usb_phy_enable(void) +{ + u32 reg; + + /* + * Set these bits so that we can force the OTG bits high + * so the ARC core operates properly + */ + writel(POWER_CTRL_CLKGATE, POWER_CTRL + CLR); + + writel(POWER_DEBUG_VBUSVALIDPIOLOCK | + POWER_DEBUG_AVALIDPIOLOCK | + POWER_DEBUG_BVALIDPIOLOCK, POWER_DEBUG + SET); + + reg = readl(POWER_STS); + reg |= POWER_STS_BVALID | POWER_STS_AVALID | POWER_STS_VBUSVALID; + writel(reg, POWER_STS); + + /* Reset USBPHY module */ + writel(USBPHY_CTRL_SFTRST, USBPHY_CTRL + SET); + udelay(10); + + /* Remove CLKGATE and SFTRST */ + writel(USBPHY_CTRL_CLKGATE | USBPHY_CTRL_SFTRST, USBPHY_CTRL + CLR); + + /* Turn on the USB clocks */ + writel(PLLCTRL0_EN_USB_CLKS, CLK_PLLCTRL0 + SET); + writel(DIGCTL_CTRL_USB_CLKGATE, DIGCTRL_CTRL + CLR); + + /* Power up the PHY */ + writel(0, USBPHY_PWD); + + /* + * Set precharge bit to cure overshoot problems at the + * start of packets + */ + writel(1, USBPHY_CTRL + SET); + + return 0; +} + |