* [PATCH 1/3] add Calao QIL A9260 support and MB-QIL A9260 Motherboard support
@ 2012-05-25 7:08 Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 2/3] at91: switch uart registration to inline Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 3/3] at91sam9260ek/9260ek/9g20ek: drop bootz and fat write support to fit in flash Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 2 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-05-25 7:08 UTC (permalink / raw)
To: barebox
with:
- led
- USB Device
- uart
- net
- mmc
- MMU
dfu support
detect it at boot time
if the user button is pressed 5s and the vbus is 1 start the dfu
otherwise the vbus is 1 start usb serial
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/Makefile | 1 +
arch/arm/boards/qil-a9260/Makefile | 1 +
arch/arm/boards/qil-a9260/config.h | 6 +
arch/arm/boards/qil-a9260/env/bin/init_board | 49 ++++++
arch/arm/boards/qil-a9260/env/config | 39 +++++
arch/arm/boards/qil-a9260/init.c | 208 ++++++++++++++++++++++++++
arch/arm/configs/qil_a9260_128mib_defconfig | 78 ++++++++++
arch/arm/configs/qil_a9260_defconfig | 77 ++++++++++
arch/arm/mach-at91/Kconfig | 13 ++-
9 files changed, 471 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/boards/qil-a9260/Makefile
create mode 100644 arch/arm/boards/qil-a9260/config.h
create mode 100644 arch/arm/boards/qil-a9260/env/bin/init_board
create mode 100644 arch/arm/boards/qil-a9260/env/config
create mode 100644 arch/arm/boards/qil-a9260/init.c
create mode 100644 arch/arm/configs/qil_a9260_128mib_defconfig
create mode 100644 arch/arm/configs/qil_a9260_defconfig
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d0bfd71..2e6402b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -122,6 +122,7 @@ board-$(CONFIG_MACH_FREESCALE_MX53_LOCO) := freescale-mx53-loco
board-$(CONFIG_MACH_FREESCALE_MX53_SMD) := freescale-mx53-smd
board-$(CONFIG_MACH_GUF_CUPID) := guf-cupid
board-$(CONFIG_MACH_MINI2440) := mini2440
+board-$(CONFIG_MACH_QIL_A9260) := qil-a9260
board-$(CONFIG_MACH_TNY_A9260) := tny-a926x
board-$(CONFIG_MACH_TNY_A9263) := tny-a926x
board-$(CONFIG_MACH_TNY_A9G20) := tny-a926x
diff --git a/arch/arm/boards/qil-a9260/Makefile b/arch/arm/boards/qil-a9260/Makefile
new file mode 100644
index 0000000..eb072c0
--- /dev/null
+++ b/arch/arm/boards/qil-a9260/Makefile
@@ -0,0 +1 @@
+obj-y += init.o
diff --git a/arch/arm/boards/qil-a9260/config.h b/arch/arm/boards/qil-a9260/config.h
new file mode 100644
index 0000000..d971810
--- /dev/null
+++ b/arch/arm/boards/qil-a9260/config.h
@@ -0,0 +1,6 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define AT91_MAIN_CLOCK 12000000 /* 12 MHz crystal */
+
+#endif /* __CONFIG_H */
diff --git a/arch/arm/boards/qil-a9260/env/bin/init_board b/arch/arm/boards/qil-a9260/env/bin/init_board
new file mode 100644
index 0000000..0a6baf7
--- /dev/null
+++ b/arch/arm/boards/qil-a9260/env/bin/init_board
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+button_name="dfu_bp"
+button_wait=5
+
+product_id=0x1234
+vendor_id=0x4321
+
+dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
+
+if [ $at91_udc0.vbus != 1 ]
+then
+ echo "No USB Device cable plugged, normal boot"
+ exit
+fi
+
+gpio_get_value ${dfu_button}
+if [ $? != 0 ]
+then
+ autoboot_timeout=16
+ echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s"
+ usbserial
+ exit
+fi
+
+echo "${button_name} pressed detected wait ${button_wait}s"
+timeout -s -a ${button_wait}
+
+if [ $at91_udc0.vbus != 1 ]
+then
+ echo "No USB Device cable plugged, normal boot"
+ exit
+fi
+
+gpio_get_value ${dfu_button}
+if [ $? != 0 ]
+then
+ echo "${button_name} released, normal boot"
+ autoboot_timeout=16
+ echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s"
+ usbserial
+ exit
+fi
+
+echo ""
+echo "Start DFU Mode"
+echo ""
+
+dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
diff --git a/arch/arm/boards/qil-a9260/env/config b/arch/arm/boards/qil-a9260/env/config
new file mode 100644
index 0000000..c0b5546
--- /dev/null
+++ b/arch/arm/boards/qil-a9260/env/config
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
+ip=dhcp-barebox
+dhcp_vendor_id=barebox-qil-a9260
+
+# 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 'nfs', 'tftp', 'nor' or 'nand'
+kernel_loc=nfs
+# can be either 'net', 'nor', 'nand' or 'initrd'
+rootfs_loc=net
+# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
+oftree_loc=none
+
+# can be either 'jffs2' or 'ubifs'
+rootfs_type=ubifs
+rootfsimage=root.$rootfs_type
+
+kernelimage=zImage
+#kernelimage=uImage
+#kernelimage=Image
+#kernelimage=Image.lzo
+
+nand_device=atmel_nand
+nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
+rootfs_mtdblock_nand=6
+
+autoboot_timeout=3
+
+bootargs="console=ttyS1,115200"
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m\n# "
diff --git a/arch/arm/boards/qil-a9260/init.c b/arch/arm/boards/qil-a9260/init.c
new file mode 100644
index 0000000..5f8dacb
--- /dev/null
+++ b/arch/arm/boards/qil-a9260/init.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * GPLv2
+ *
+ */
+
+#include <common.h>
+#include <net.h>
+#include <init.h>
+#include <environment.h>
+#include <asm/armlinux.h>
+#include <generated/mach-types.h>
+#include <partition.h>
+#include <fs.h>
+#include <fcntl.h>
+#include <io.h>
+#include <asm/hardware.h>
+#include <nand.h>
+#include <sizes.h>
+#include <linux/mtd/nand.h>
+#include <linux/clk.h>
+#include <mach/board.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/sam9_smc.h>
+#include <gpio.h>
+#include <led.h>
+#include <mach/io.h>
+#include <mach/at91_pmc.h>
+#include <mach/at91_rstc.h>
+
+static struct atmel_nand_data nand_pdata = {
+ .ale = 21,
+ .cle = 22,
+ .det_pin = 0,
+ .rdy_pin = AT91_PIN_PC13,
+ .enable_pin = AT91_PIN_PC14,
+ .on_flash_bbt = 1,
+};
+
+static struct sam9_smc_config nand_smc_config = {
+ .ncs_read_setup = 0,
+ .nrd_setup = 1,
+ .ncs_write_setup = 0,
+ .nwe_setup = 1,
+
+ .ncs_read_pulse = 3,
+ .nrd_pulse = 3,
+ .ncs_write_pulse = 3,
+ .nwe_pulse = 3,
+
+ .read_cycle = 5,
+ .write_cycle = 5,
+
+ .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
+ .tdf_cycles = 2,
+};
+
+static void qil_a9260_add_device_nand(void)
+{
+ /* configure chip-select 3 (NAND) */
+ sam9_smc_configure(3, &nand_smc_config);
+
+ at91_add_device_nand(&nand_pdata);
+}
+
+#if defined(CONFIG_MCI_ATMEL)
+static struct atmel_mci_platform_data __initdata qil_a9260_mci_data = {
+ .bus_width = 4,
+};
+
+static void qil_a9260_add_device_mci(void)
+{
+ at91_add_device_mci(0, &qil_a9260_mci_data);
+}
+#else
+static void qil_a9260_add_device_mci(void) {}
+#endif
+
+#ifdef CONFIG_CALAO_MB_QIL_A9260
+static struct at91_ether_platform_data macb_pdata = {
+ .flags = AT91SAM_ETHER_RMII,
+ .phy_addr = 0,
+};
+
+static void qil_a9260_phy_reset(void)
+{
+ unsigned long rstc;
+ struct clk *clk = clk_get(NULL, "macb_clk");
+
+ clk_enable(clk);
+
+ at91_set_gpio_input(AT91_PIN_PA14, 0);
+ at91_set_gpio_input(AT91_PIN_PA15, 0);
+ at91_set_gpio_input(AT91_PIN_PA17, 0);
+ at91_set_gpio_input(AT91_PIN_PA25, 0);
+ at91_set_gpio_input(AT91_PIN_PA26, 0);
+ at91_set_gpio_input(AT91_PIN_PA28, 0);
+
+ rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
+
+ /* Need to reset PHY -> 500ms reset */
+ at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
+ (AT91_RSTC_ERSTL & (0x0d << 8)) |
+ AT91_RSTC_URSTEN);
+
+ at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST);
+
+ /* Wait for end hardware reset */
+ while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL));
+
+ /* Restore NRST value */
+ at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
+ (rstc) |
+ AT91_RSTC_URSTEN);
+}
+
+/*
+ * USB Device port
+ */
+static struct at91_udc_data __initdata ek_udc_data = {
+ .vbus_pin = AT91_PIN_PC5,
+ .pullup_pin = 0, /* pull-up driven by UDC */
+};
+
+static void __init qil_a9260_add_device_mb(void)
+{
+ qil_a9260_phy_reset();
+ at91_add_device_eth(0, &macb_pdata);
+ at91_add_device_udc(&ek_udc_data);
+}
+#else
+static void __init qil_a9260_add_device_mb(void)
+{
+}
+#endif
+
+struct gpio_led led = {
+ .gpio = AT91_PIN_PB21,
+ .led = {
+ .name = "user_led",
+ },
+};
+
+static void __init ek_add_led(void)
+{
+ at91_set_gpio_output(led.gpio, led.active_low);
+ led_gpio_register(&led);
+}
+
+static int qil_a9260_mem_init(void)
+{
+#ifdef CONFIG_AT91_HAVE_SRAM_128M
+ at91_add_device_sdram(128 * 1024 * 1024);
+#else
+ at91_add_device_sdram(64 * 1024 * 1024);
+#endif
+
+ return 0;
+}
+mem_initcall(qil_a9260_mem_init);
+
+static void __init ek_add_device_button(void)
+{
+ at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
+ at91_set_deglitch(AT91_PIN_PB10, 1);
+
+ export_env_ull("dfu_button", AT91_PIN_PB10);
+}
+
+static int qil_a9260_devices_init(void)
+{
+ qil_a9260_add_device_nand();
+ qil_a9260_add_device_mci();
+ ek_add_led();
+ ek_add_device_button();
+ qil_a9260_add_device_mb();
+
+ armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100));
+ armlinux_set_architecture(MACH_TYPE_QIL_A9260);
+
+ devfs_add_partition("nand0", 0x00000, SZ_128K, PARTITION_FIXED, "at91bootstrap_raw");
+ dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
+ devfs_add_partition("nand0", SZ_128K, SZ_256K, PARTITION_FIXED, "self_raw");
+ dev_add_bb_dev("self_raw", "self0");
+ devfs_add_partition("nand0", SZ_256K + SZ_128K, SZ_128K, PARTITION_FIXED, "env_raw");
+ dev_add_bb_dev("env_raw", "env0");
+ devfs_add_partition("nand0", SZ_512K, SZ_128K, PARTITION_FIXED, "env_raw1");
+ dev_add_bb_dev("env_raw1", "env1");
+
+ return 0;
+}
+device_initcall(qil_a9260_devices_init);
+
+#ifdef CONFIG_CALAO_MB_QIL_A9260
+static int qil_a9260_console_init(void)
+{
+ at91_register_uart(0, 0);
+ at91_register_uart(1, ATMEL_UART_CTS | ATMEL_UART_RTS
+ | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
+ | ATMEL_UART_RI);
+ at91_register_uart(2, ATMEL_UART_CTS | ATMEL_UART_RTS);
+ at91_register_uart(3, ATMEL_UART_CTS | ATMEL_UART_RTS);
+
+ return 0;
+}
+console_initcall(qil_a9260_console_init);
+#endif
diff --git a/arch/arm/configs/qil_a9260_128mib_defconfig b/arch/arm/configs/qil_a9260_128mib_defconfig
new file mode 100644
index 0000000..555d94f
--- /dev/null
+++ b/arch/arm/configs/qil_a9260_128mib_defconfig
@@ -0,0 +1,78 @@
+CONFIG_ARCH_AT91SAM9260=y
+CONFIG_MACH_QIL_A9260=y
+CONFIG_AT91_HAVE_SRAM_128M=y
+CONFIG_CALAO_MB_QIL_A9260=y
+CONFIG_AEABI=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_MMU=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
+CONFIG_EXPERIMENTAL=y
+CONFIG_PROMPT="USB-9G20:"
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_PROMPT_HUSH_PS2="y"
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+# CONFIG_CONSOLE_ACTIVATE_FIRST is not set
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/qil-a9260/env"
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_MTEST_ALTERNATIVE=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
+CONFIG_CMD_BOOTM_VERBOSE=y
+CONFIG_CMD_BOOTM_INITRD=y
+CONFIG_CMD_BOOTM_OFTREE=y
+CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
+CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTZ is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_GPIO=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_MACB=y
+# CONFIG_SPI is not set
+CONFIG_MTD=y
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_HW is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+CONFIG_NAND_ATMEL=y
+CONFIG_UBI=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DFU=y
+CONFIG_USB_GADGET_SERIAL=y
+CONFIG_MCI=y
+CONFIG_MCI_ATMEL=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_TRIGGERS=y
diff --git a/arch/arm/configs/qil_a9260_defconfig b/arch/arm/configs/qil_a9260_defconfig
new file mode 100644
index 0000000..9e54a14
--- /dev/null
+++ b/arch/arm/configs/qil_a9260_defconfig
@@ -0,0 +1,77 @@
+CONFIG_ARCH_AT91SAM9260=y
+CONFIG_MACH_QIL_A9260=y
+CONFIG_CALAO_MB_QIL_A9260=y
+CONFIG_AEABI=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_MMU=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
+CONFIG_EXPERIMENTAL=y
+CONFIG_PROMPT="USB-9G20:"
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_PROMPT_HUSH_PS2="y"
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+# CONFIG_CONSOLE_ACTIVATE_FIRST is not set
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/qil-a9260/env"
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_MTEST_ALTERNATIVE=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
+CONFIG_CMD_BOOTM_VERBOSE=y
+CONFIG_CMD_BOOTM_INITRD=y
+CONFIG_CMD_BOOTM_OFTREE=y
+CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
+CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTZ is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_GPIO=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_MACB=y
+# CONFIG_SPI is not set
+CONFIG_MTD=y
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_HW is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+CONFIG_NAND_ATMEL=y
+CONFIG_UBI=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DFU=y
+CONFIG_USB_GADGET_SERIAL=y
+CONFIG_MCI=y
+CONFIG_MCI_ATMEL=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_TRIGGERS=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 1bec3e5..7514ea9 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -25,6 +25,7 @@ config BOARDINFO
default "Calao TNY-A9260" if MACH_TNY_A9260
default "Calao TNY-A9263" if MACH_TNY_A9263
default "Calao TNY-A9G20" if MACH_TNY_A9G20
+ default "Calao QIL-A9260" if MACH_QIL_A9260
config HAVE_NAND_ATMEL_BUSWIDTH_16
bool
@@ -139,6 +140,12 @@ config MACH_AT91SAM9260EK
help
Say y here if you are using Atmel's AT91SAM9260-EK Evaluation board
+config MACH_QIL_A9260
+ bool "CALAO QIL-A9260 board"
+ help
+ Select this if you are using a Calao Systems QIL-A9260 Board.
+ <http://www.calao-systems.com>
+
config MACH_TNY_A9260
bool "CALAO TNY-A9260"
select SUPPORT_CALAO_MOB_TNY_MD2
@@ -344,7 +351,7 @@ config AT91_HAVE_2MMC
config AT91_HAVE_SRAM_128M
bool "Have 128 of ram"
- depends on MACH_USB_A9G20 || MACH_USB_A9263
+ depends on MACH_USB_A9G20 || MACH_USB_A9263 || MACH_QIL_A9260
help
Select this if you board have 128 MiB of Ram (as USB_A9G20 C11)
@@ -372,4 +379,8 @@ config CALAO_MOB_TNY_MD2
bool "MOB TNY MD2 Motherboard Daughter Board support"
depends on SUPPORT_CALAO_MOB_TNY_MD2
+config CALAO_MB_QIL_A9260
+ bool "MB-QIL A9260 Motherboard Board support"
+ depends on MACH_QIL_A9260
+
endif
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] at91: switch uart registration to inline
2012-05-25 7:08 [PATCH 1/3] add Calao QIL A9260 support and MB-QIL A9260 Motherboard support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-05-25 7:08 ` Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 3/3] at91sam9260ek/9260ek/9g20ek: drop bootz and fat write support to fit in flash Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-05-25 7:08 UTC (permalink / raw)
To: barebox
this allow to save between 100 to 300 bytes
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/at91rm9200_devices.c | 51 +++++--------------
arch/arm/mach-at91/at91sam9260_devices.c | 67 +++++++-----------------
arch/arm/mach-at91/at91sam9261_devices.c | 43 ++++------------
arch/arm/mach-at91/at91sam9263_devices.c | 43 ++++------------
arch/arm/mach-at91/at91sam9g45_devices.c | 51 +++++--------------
arch/arm/mach-at91/at91sam9x5_devices.c | 62 +++++------------------
arch/arm/mach-at91/include/mach/at91rm9200.h | 2 +
arch/arm/mach-at91/include/mach/at91sam9260.h | 1 +
arch/arm/mach-at91/include/mach/at91sam9261.h | 1 +
arch/arm/mach-at91/include/mach/at91sam9263.h | 1 +
arch/arm/mach-at91/include/mach/at91sam9g45.h | 1 +
arch/arm/mach-at91/include/mach/at91sam9x5.h | 1 +
arch/arm/mach-at91/include/mach/board.h | 56 ++++++++++++++++++++-
13 files changed, 146 insertions(+), 234 deletions(-)
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index a165cc9..d5268dd 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -201,13 +201,15 @@ void __init at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata
* UART
* -------------------------------------------------------------------- */
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PA30, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PA31, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */
@@ -222,9 +224,11 @@ static inline void configure_usart0_pins(unsigned pins)
*/
at91_set_gpio_output(AT91_PIN_PA21, 1);
}
+
+ return AT91RM9200_BASE_US0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */
@@ -241,9 +245,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */
if (pins & ATMEL_UART_RTS)
at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */
+
+ return AT91RM9200_BASE_US1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */
at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */
@@ -252,9 +258,11 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */
if (pins & ATMEL_UART_RTS)
at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */
+
+ return AT91RM9200_BASE_US2;
}
-static inline void configure_usart3_pins(unsigned pins)
+resource_size_t __init at91_configure_usart3(unsigned pins)
{
at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */
at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */
@@ -263,37 +271,6 @@ static inline void configure_usart3_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */
if (pins & ATMEL_UART_RTS)
at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case 1:
- configure_usart0_pins(pins);
- start = AT91RM9200_BASE_US0;
- break;
- case 2:
- configure_usart1_pins(pins);
- start = AT91RM9200_BASE_US1;
- break;
- case 3:
- configure_usart2_pins(pins);
- start = AT91RM9200_BASE_US2;
- break;
- case 4:
- configure_usart3_pins(pins);
- start = AT91RM9200_BASE_US3;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, 4096,
- IORESOURCE_MEM, NULL);
+ return AT91RM9200_BASE_US3;
}
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 33f070a..3297a89 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -212,13 +212,15 @@ void __init at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata
void __init at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata) {}
#endif
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
@@ -235,9 +237,11 @@ static inline void configure_usart0_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
if (pins & ATMEL_UART_RI)
at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
+
+ return AT91SAM9260_BASE_US0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
@@ -246,9 +250,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
+
+ return AT91SAM9260_BASE_US1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
@@ -257,9 +263,11 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
+
+ return AT91SAM9260_BASE_US2;
}
-static inline void configure_usart3_pins(unsigned pins)
+resource_size_t __init at91_configure_usart3(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
@@ -268,59 +276,24 @@ static inline void configure_usart3_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
+
+ return AT91SAM9260_BASE_US3;
}
-static inline void configure_usart4_pins(void)
+resource_size_t __init at91_configure_usart4(unsigned pins)
{
at91_set_B_periph(AT91_PIN_PA31, 1); /* TXD4 */
at91_set_B_periph(AT91_PIN_PA30, 0); /* RXD4 */
+
+ return AT91SAM9260_BASE_US4;
}
-static inline void configure_usart5_pins(void)
+resource_size_t __init at91_configure_usart5(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB12, 1); /* TXD5 */
at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case 1:
- configure_usart0_pins(pins);
- start = AT91SAM9260_BASE_US0;
- break;
- case 2:
- configure_usart1_pins(pins);
- start = AT91SAM9260_BASE_US1;
- break;
- case 3:
- configure_usart2_pins(pins);
- start = AT91SAM9260_BASE_US2;
- break;
- case 4:
- configure_usart3_pins(pins);
- start = AT91SAM9260_BASE_US3;
- break;
- case 5:
- configure_usart4_pins();
- start = AT91SAM9260_BASE_US4;
- break;
- case 6:
- configure_usart5_pins();
- start = AT91SAM9260_BASE_US5;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, 4096,
- IORESOURCE_MEM, NULL);
+ return AT91SAM9260_BASE_US5;
}
#if defined(CONFIG_MCI_ATMEL)
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 82d17a2..41eeeae 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -164,13 +164,15 @@ void at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata)
void __init at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata) {}
#endif
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */
@@ -179,9 +181,11 @@ static inline void configure_usart0_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */
+
+ return AT91SAM9261_BASE_US0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */
@@ -190,9 +194,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PA12, 0); /* RTS1 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PA13, 0); /* CTS1 */
+
+ return AT91SAM9261_BASE_US1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */
at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */
@@ -201,35 +207,8 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PA15, 0); /* RTS2*/
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case 1:
- configure_usart0_pins(pins);
- start = AT91SAM9261_BASE_US0;
- break;
- case 2:
- configure_usart1_pins(pins);
- start = AT91SAM9261_BASE_US1;
- break;
- case 3:
- configure_usart2_pins(pins);
- start = AT91SAM9261_BASE_US2;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, 4096,
- IORESOURCE_MEM, NULL);
+ return AT91SAM9261_BASE_US2;
}
#if defined(CONFIG_MCI_ATMEL)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 4500d81..2ebc4da 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -214,13 +214,15 @@ void at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata)
void __init at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata) {}
#endif
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */
@@ -229,9 +231,11 @@ static inline void configure_usart0_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */
+
+ return AT91SAM9263_BASE_US0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
@@ -240,9 +244,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */
+
+ return AT91SAM9263_BASE_US1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
@@ -251,35 +257,8 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case 1:
- configure_usart0_pins(pins);
- start = AT91SAM9263_BASE_US0;
- break;
- case 2:
- configure_usart1_pins(pins);
- start = AT91SAM9263_BASE_US1;
- break;
- case 3:
- configure_usart2_pins(pins);
- start = AT91SAM9263_BASE_US2;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, 4096,
- IORESOURCE_MEM, NULL);
+ return AT91SAM9263_BASE_US2;
}
#if defined(CONFIG_MCI_ATMEL)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 273cd0e..d406bcc 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -132,13 +132,15 @@ void at91_add_device_nand(struct atmel_nand_data *data)
void at91_add_device_nand(struct atmel_nand_data *data) {}
#endif
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PB12, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PB13, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB19, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PB18, 0); /* RXD0 */
@@ -147,9 +149,11 @@ static inline void configure_usart0_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PB17, 0); /* RTS0 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PB15, 0); /* CTS0 */
+
+ return AT91SAM9G45_BASE_US0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD1 */
@@ -158,9 +162,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PD16, 0); /* RTS1 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PD17, 0); /* CTS1 */
+
+ return AT91SAM9G45_BASE_US1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD2 */
at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD2 */
@@ -169,9 +175,11 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PC9, 0); /* RTS2 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PC11, 0); /* CTS2 */
+
+ return AT91SAM9G45_BASE_US2;
}
-static inline void configure_usart3_pins(unsigned pins)
+resource_size_t __init at91_configure_usart3(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD3 */
at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD3 */
@@ -180,39 +188,8 @@ static inline void configure_usart3_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PA23, 0); /* RTS3 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PA24, 0); /* CTS3 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case 1:
- configure_usart0_pins(pins);
- start = AT91SAM9G45_BASE_US0;
- break;
- case 2:
- configure_usart1_pins(pins);
- start = AT91SAM9G45_BASE_US1;
- break;
- case 3:
- configure_usart2_pins(pins);
- start = AT91SAM9G45_BASE_US2;
- break;
- case 4:
- configure_usart3_pins(pins);
- start = AT91SAM9G45_BASE_US3;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, 4096,
- IORESOURCE_MEM, NULL);
+ return AT91SAM9G45_BASE_US3;
}
#if defined(CONFIG_MCI_ATMEL)
diff --git a/arch/arm/mach-at91/at91sam9x5_devices.c b/arch/arm/mach-at91/at91sam9x5_devices.c
index 51a2024..50bad7f 100644
--- a/arch/arm/mach-at91/at91sam9x5_devices.c
+++ b/arch/arm/mach-at91/at91sam9x5_devices.c
@@ -174,13 +174,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) {}
* -------------------------------------------------------------------- */
#if defined(CONFIG_DRIVER_SERIAL_ATMEL)
-static inline void configure_dbgu_pins(void)
+resource_size_t __init at91_configure_dbgu(void)
{
at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */
at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */
+
+ return AT91_BASE_SYS + AT91_DBGU;
}
-static inline void configure_usart0_pins(unsigned pins)
+resource_size_t __init at91_configure_usart0(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA0, 1); /* TXD0 */
at91_set_A_periph(AT91_PIN_PA1, 0); /* RXD0 */
@@ -189,9 +191,11 @@ static inline void configure_usart0_pins(unsigned pins)
at91_set_A_periph(AT91_PIN_PA2, 0); /* RTS0 */
if (pins & ATMEL_UART_CTS)
at91_set_A_periph(AT91_PIN_PA3, 0); /* CTS0 */
+
+ return AT91SAM9X5_BASE_USART0;
}
-static inline void configure_usart1_pins(unsigned pins)
+resource_size_t __init at91_configure_usart1(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA5, 1); /* TXD1 */
at91_set_A_periph(AT91_PIN_PA6, 0); /* RXD1 */
@@ -200,9 +204,11 @@ static inline void configure_usart1_pins(unsigned pins)
at91_set_C_periph(AT91_PIN_PC27, 0); /* RTS1 */
if (pins & ATMEL_UART_CTS)
at91_set_C_periph(AT91_PIN_PC28, 0); /* CTS1 */
+
+ return AT91SAM9X5_BASE_USART1;
}
-static inline void configure_usart2_pins(unsigned pins)
+resource_size_t __init at91_configure_usart2(unsigned pins)
{
at91_set_A_periph(AT91_PIN_PA7, 1); /* TXD2 */
at91_set_A_periph(AT91_PIN_PA8, 0); /* RXD2 */
@@ -211,9 +217,11 @@ static inline void configure_usart2_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS2 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS2 */
+
+ return AT91SAM9X5_BASE_USART2;
}
-static inline void configure_usart3_pins(unsigned pins)
+resource_size_t __init at91_configure_usart3(unsigned pins)
{
at91_set_B_periph(AT91_PIN_PC22, 1); /* TXD3 */
at91_set_B_periph(AT91_PIN_PC23, 0); /* RXD3 */
@@ -222,49 +230,7 @@ static inline void configure_usart3_pins(unsigned pins)
at91_set_B_periph(AT91_PIN_PC24, 0); /* RTS3 */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PC25, 0); /* CTS3 */
-}
-
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- resource_size_t start;
- resource_size_t size = SZ_16K;
-
- switch (id) {
- case 0: /* DBGU */
- configure_dbgu_pins();
- size = 512;
- start = AT91_BASE_SYS + AT91_DBGU;
- break;
- case AT91SAM9X5_ID_USART0:
- configure_usart0_pins(pins);
- start = AT91SAM9X5_BASE_USART0;
- id = 1;
- break;
- case AT91SAM9X5_ID_USART1:
- configure_usart1_pins(pins);
- start = AT91SAM9X5_BASE_USART1;
- id = 2;
- break;
- case AT91SAM9X5_ID_USART2:
- configure_usart2_pins(pins);
- start = AT91SAM9X5_BASE_USART2;
- id = 3;
- break;
- case AT91SAM9X5_ID_USART3:
- configure_usart3_pins(pins);
- start = AT91SAM9X5_BASE_USART3;
- id = 4;
- break;
- default:
- return NULL;
- }
- return add_generic_device("atmel_usart", id, NULL, start, size,
- IORESOURCE_MEM, NULL);
-}
-#else
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins)
-{
- return NULL;
+ return AT91SAM9X5_BASE_USART3;
}
#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
index 39b1e15..2850f0d 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -98,6 +98,7 @@
#define AT91_USART1 AT91RM9200_BASE_US1
#define AT91_USART2 AT91RM9200_BASE_US2
#define AT91_USART3 AT91RM9200_BASE_US3
+#define AT91_NB_USART 5
#define AT91_BASE_SPI AT91RM9200_BASE_SPI
#define AT91_BASE_TWI AT91RM9200_BASE_TWI
@@ -107,6 +108,7 @@
#define AT91_MATRIX 0 /* not supported */
+
/*
* Internal Memory.
*/
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index ca273cb..be07e57 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -105,6 +105,7 @@
#define AT91_USART3 AT91SAM9260_BASE_US3
#define AT91_USART4 AT91SAM9260_BASE_US4
#define AT91_USART5 AT91SAM9260_BASE_US5
+#define AT91_NB_USART 7
#define AT91_BASE_SPI AT91SAM9260_BASE_SPI0
#define AT91_BASE_TWI AT91SAM9260_BASE_TWI
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 3be8087..d51673e 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -88,6 +88,7 @@
#define AT91_USART0 AT91SAM9261_BASE_US0
#define AT91_USART1 AT91SAM9261_BASE_US1
#define AT91_USART2 AT91SAM9261_BASE_US2
+#define AT91_NB_USART 4
/*
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index 64f4fcc..c8374a7 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -105,6 +105,7 @@
#define AT91_USART0 AT91SAM9263_BASE_US0
#define AT91_USART1 AT91SAM9263_BASE_US1
#define AT91_USART2 AT91SAM9263_BASE_US2
+#define AT91_NB_USART 4
#define AT91_SMC AT91_SMC0
#define AT91_SDRAMC AT91_SDRAMC0
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index 18fa6c5..10f3170 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -116,6 +116,7 @@
#define AT91_USART1 AT91SAM9G45_BASE_US1
#define AT91_USART2 AT91SAM9G45_BASE_US2
#define AT91_USART3 AT91SAM9G45_BASE_US3
+#define AT91_NB_USART 5
/*
* Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index 7d40f7c..2240710 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -117,6 +117,7 @@
#define AT91_USART1 AT91SAM9X5_BASE_US1
#define AT91_USART2 AT91SAM9X5_BASE_US2
#define AT91_USART3 AT91SAM9X5_BASE_US3
+#define AT91_NB_USART 5
/*
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index f45bad6..c142fee 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -21,6 +21,8 @@
#ifndef __ASM_ARCH_BOARD_H
#define __ASM_ARCH_BOARD_H
+#include <mach/hardware.h>
+#include <sizes.h>
#include <net.h>
#include <spi/spi.h>
#include <linux/mtd/mtd.h>
@@ -83,7 +85,59 @@ void at91_add_device_sdram(u32 size);
#define ATMEL_UART_DCD 0x10
#define ATMEL_UART_RI 0x20
-struct device_d * __init at91_register_uart(unsigned id, unsigned pins);
+resource_size_t __init at91_configure_dbgu(void);
+resource_size_t __init at91_configure_usart0(unsigned pins);
+resource_size_t __init at91_configure_usart1(unsigned pins);
+resource_size_t __init at91_configure_usart2(unsigned pins);
+resource_size_t __init at91_configure_usart3(unsigned pins);
+resource_size_t __init at91_configure_usart4(unsigned pins);
+resource_size_t __init at91_configure_usart5(unsigned pins);
+
+#if defined(CONFIG_DRIVER_SERIAL_ATMEL)
+static inline struct device_d * at91_register_uart(unsigned id, unsigned pins)
+{
+ resource_size_t start;
+ resource_size_t size = SZ_16K;
+
+ if (id >= AT91_NB_USART)
+ return NULL;
+
+ switch (id) {
+ case 0: /* DBGU */
+ start = at91_configure_dbgu();
+ size = 512;
+ break;
+ case 1:
+ start = at91_configure_usart0(pins);
+ break;
+ case 2:
+ start = at91_configure_usart1(pins);
+ break;
+ case 3:
+ start = at91_configure_usart2(pins);
+ break;
+ case 4:
+ start = at91_configure_usart3(pins);
+ break;
+ case 5:
+ start = at91_configure_usart4(pins);
+ break;
+ case 6:
+ start = at91_configure_usart5(pins);
+ break;
+ default:
+ return NULL;
+ }
+
+ return add_generic_device("atmel_usart", id, NULL, start, size,
+ IORESOURCE_MEM, NULL);
+}
+#else
+static inline struct device_d * at91_register_uart(unsigned id, unsigned pins)
+{
+ return NULL;
+}
+#endif
/* Multimedia Card Interface */
struct atmel_mci_platform_data {
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] at91sam9260ek/9260ek/9g20ek: drop bootz and fat write support to fit in flash
2012-05-25 7:08 [PATCH 1/3] add Calao QIL A9260 support and MB-QIL A9260 Motherboard support Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 2/3] at91: switch uart registration to inline Jean-Christophe PLAGNIOL-VILLARD
@ 2012-05-25 7:08 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-05-25 7:08 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/configs/at91sam9260ek_defconfig | 2 +-
arch/arm/configs/at91sam9263ek_defconfig | 1 -
arch/arm/configs/at91sam9g20ek_defconfig | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index ec8ab22..e6b5d1f 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -33,6 +33,7 @@ CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTZ is not set
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
@@ -68,5 +69,4 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index ec9c1b6..3b5c8b0 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -67,5 +67,4 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 49876c0..3ecba68 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTZ is not set
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
@@ -69,5 +70,4 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-25 7:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-25 7:08 [PATCH 1/3] add Calao QIL A9260 support and MB-QIL A9260 Motherboard support Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 2/3] at91: switch uart registration to inline Jean-Christophe PLAGNIOL-VILLARD
2012-05-25 7:08 ` [PATCH 3/3] at91sam9260ek/9260ek/9g20ek: drop bootz and fat write support to fit in flash Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox