mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH
@ 2012-04-27  9:32 Juergen Beisert
  2012-04-27  9:32 ` [PATCH 1/7] netX: add a few base addresses for non on chip devices Juergen Beisert
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

This patch series adds the new Hilscher THLINK-ETH platform and in preparation
to it some fixes, cleanups and helper functions.

Comments are welcome.
Juergen


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] netX: add a few base addresses for non on chip devices
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 2/7] netX: unify the device registration Juergen Beisert
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-netx/include/mach/netx-regs.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
index 27b7b8f..8496f3a 100644
--- a/arch/arm/mach-netx/include/mach/netx-regs.h
+++ b/arch/arm/mach-netx/include/mach/netx-regs.h
@@ -20,6 +20,11 @@
 #ifndef __ASM_ARCH_NETX_REGS_H
 #define __ASM_ARCH_NETX_REGS_H
 
+#define NETX_SDRAM_BASE 0x80000000
+#define NETX_CS0_BASE 0xc0000000
+#define NETX_CS1_BASE 0xc8000000
+#define NETX_CS2_BASE 0xd0000000
+
 #define NETX_IO_PHYS 0x00100000
 #define io_p2v(x) (x)
 #define __REG(base,ofs)       (*((volatile unsigned long *)(io_p2v(base) + ofs)))
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/7] netX: unify the device registration
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
  2012-04-27  9:32 ` [PATCH 1/7] netX: add a few base addresses for non on chip devices Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 3/7] netX: UART may not initialize correctly Juergen Beisert
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-netx/include/mach/netx-devices.h |   73 ++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 arch/arm/mach-netx/include/mach/netx-devices.h

diff --git a/arch/arm/mach-netx/include/mach/netx-devices.h b/arch/arm/mach-netx/include/mach/netx-devices.h
new file mode 100644
index 0000000..9c64adb
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/netx-devices.h
@@ -0,0 +1,73 @@
+/*
+ * (c) 2012 Pengutronix, Juergen Beisert <kernel@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.
+ */
+
+#ifndef _NETX_DEVICES_H
+# define _NETX_DEVICES_H
+
+#include <mach/netx-regs.h>
+
+static inline struct device_d *netx_add_uart(resource_size_t base, int index)
+{
+	return add_generic_device("netx_serial", index, NULL,
+				base, 0x40, IORESOURCE_MEM, NULL);
+}
+
+static inline struct device_d *netx_add_uart0(void)
+{
+	return netx_add_uart(NETX_PA_UART0, 0);
+}
+
+static inline struct device_d *netx_add_uart1(void)
+{
+	return netx_add_uart(NETX_PA_UART1, 1);
+}
+
+static inline struct device_d *netx_add_uart3(void)
+{
+	return netx_add_uart(NETX_PA_UART2, 2);
+}
+
+/* parallel flash connected to the SRAM interface */
+static inline struct device_d *netx_add_pflash(resource_size_t size)
+{
+	return add_cfi_flash_device(0, NETX_CS0_BASE, size, 0);
+}
+
+static inline struct device_d *netx_add_eth(int index, void *pdata)
+{
+	return add_generic_device("netx-eth", index, NULL,
+					0, 0, IORESOURCE_MEM, pdata);
+}
+
+static inline struct device_d *netx_add_eth0(void *pdata)
+{
+	return netx_add_eth(0, pdata);
+}
+
+static inline struct device_d *netx_add_eth1(void *pdata)
+{
+	return netx_add_eth(1, pdata);
+}
+
+static inline struct device_d *netx_add_eth2(void *pdata)
+{
+	return netx_add_eth(2, pdata);
+}
+
+static inline struct device_d *netx_add_eth3(void *pdata)
+{
+	return netx_add_eth(3, pdata);
+}
+
+#endif /* _NETX_DEVICES_H */
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/7] netX: UART may not initialize correctly.
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
  2012-04-27  9:32 ` [PATCH 1/7] netX: add a few base addresses for non on chip devices Juergen Beisert
  2012-04-27  9:32 ` [PATCH 2/7] netX: unify the device registration Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 4/7] netX/network: fix debug outputs Juergen Beisert
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox; +Cc: Michael Trensch

From: Michael Trensch <MTrensch@gmail.com>

The netX internal UART latches register settings and internally uses
them only if written in the correct order. Other orders may work, but
sometimes the UART gets stuck, as the baudrate has not correctly been
set.

Signed-off-by: Michael Trensch <MTrensch@gmail.com>
Acked-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/serial/serial_netx.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/serial/serial_netx.c b/drivers/serial/serial_netx.c
index 2d4ef11..838293f 100644
--- a/drivers/serial/serial_netx.c
+++ b/drivers/serial/serial_netx.c
@@ -77,10 +77,7 @@ static int netx_serial_init_port(struct console_device *cdev)
 
 	/* disable uart */
 	writel(0, base + UART_CR);
-
-	writel(LINE_CR_8BIT | LINE_CR_FEN, base + UART_LINE_CR);
-
-	writel(DRV_ENABLE_TX | DRV_ENABLE_RTS, base + UART_DRV_ENABLE);
+	writel(BRM_CR_BAUD_RATE_MODE, base + UART_BRM_CR);
 
 	/* set baud rate */
 	divisor = 115200 * 4096;
@@ -88,9 +85,11 @@ static int netx_serial_init_port(struct console_device *cdev)
 	divisor *= 256;
 	divisor /= 100000;
 
-	writel((divisor >> 8) & 0xff, base + UART_BAUDDIV_MSB);
 	writel(divisor & 0xff, base + UART_BAUDDIV_LSB);
-	writel(BRM_CR_BAUD_RATE_MODE, base + UART_BRM_CR);
+	writel((divisor >> 8) & 0xff, base + UART_BAUDDIV_MSB);
+	writel(DRV_ENABLE_TX | DRV_ENABLE_RTS, base + UART_DRV_ENABLE);
+
+	writel(LINE_CR_8BIT | LINE_CR_FEN, base + UART_LINE_CR);
 
 	/* Finally, enable the UART */
 	writel(CR_UARTEN, base + UART_CR);
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/7] netX/network: fix debug outputs
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
                   ` (2 preceding siblings ...)
  2012-04-27  9:32 ` [PATCH 3/7] netX: UART may not initialize correctly Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 5/7] netX: XPEC firmware is always of attribute const Juergen Beisert
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

If DEBUG is defined it fails due to wrong variable names

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/net/netx_eth.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netx_eth.c b/drivers/net/netx_eth.c
index 345dad4..2d92a2e 100644
--- a/drivers/net/netx_eth.c
+++ b/drivers/net/netx_eth.c
@@ -130,7 +130,7 @@ static int netx_miidev_read(struct mii_device *mdev, int phy_addr, int reg)
 	value = MIIMU_REG >> 16;
 
 	debug("%s: addr: 0x%02x reg: 0x%02x val: 0x%04x\n", __func__,
-	      addr, reg, value);
+	      phy_addr, reg, value);
 
 	return value;
 }
@@ -139,7 +139,7 @@ static int netx_miidev_write(struct mii_device *mdev, int phy_addr,
 	int reg, int val)
 {
 	debug("%s: addr: 0x%02x reg: 0x%02x val: 0x%04x\n",__func__,
-	      addr, reg, val);
+	      phy_addr, reg, val);
 
 	MIIMU_REG = MIIMU_SNRDY | MIIMU_PREAMBLE | MIIMU_PHYADDR(phy_addr) |
 	            MIIMU_REGADDR(reg) | MIIMU_PHY_NRES | MIIMU_OPMODE_WRITE |
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/7] netX: XPEC firmware is always of attribute const
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
                   ` (3 preceding siblings ...)
  2012-04-27  9:32 ` [PATCH 4/7] netX/network: fix debug outputs Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 6/7] netX: don't bother with variable sizes, use the intend Juergen Beisert
  2012-04-27  9:32 ` [PATCH 7/7] netX: add the 'th link' platform Juergen Beisert
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-netx/generic.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index f9d643f..5ce7a0d 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -45,9 +45,10 @@ static int xc_check_ptr(int xcno, unsigned long adr, unsigned int size)
 	return -1;
 }
 
-static int xc_patch(int xcno, void *patch, int count)
+static int xc_patch(int xcno, const void *patch, int count)
 {
-	unsigned int adr, val, *p = patch;
+	unsigned int adr, val;
+	const unsigned int *p = patch;
 
 	int i;
 	for (i = 0; i < count; i++) {
@@ -69,11 +70,11 @@ static void memset32(void *s, int c, int n)
 		*t++ = 0;
 }
 
-static void memcpy32(void *trg, void *src, int size)
+static void memcpy32(void *trg, const void *src, int size)
 {
 	int i;
 	u32 *t = trg;
-	u32 *s = src;
+	const u32 *s = src;
 	for (i = 0; i < (size >> 2); i++)
 		*t++ = *s++;
 }
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/7] netX: don't bother with variable sizes, use the intend
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
                   ` (4 preceding siblings ...)
  2012-04-27  9:32 ` [PATCH 5/7] netX: XPEC firmware is always of attribute const Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-27  9:32 ` [PATCH 7/7] netX: add the 'th link' platform Juergen Beisert
  6 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-netx/generic.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 5ce7a0d..53b0c60 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <io.h>
 #include <mach/netx-regs.h>
 #include "eth_firmware.h"
 
@@ -45,18 +46,17 @@ static int xc_check_ptr(int xcno, unsigned long adr, unsigned int size)
 	return -1;
 }
 
-static int xc_patch(int xcno, const void *patch, int count)
+static int xc_patch(int xcno, const u32 *patch, int count)
 {
 	unsigned int adr, val;
-	const unsigned int *p = patch;
 
 	int i;
 	for (i = 0; i < count; i++) {
-		adr = *p++;
-		val = *p++;
+		adr = *patch++;
+		val = *patch++;
 		if (xc_check_ptr(xcno, adr, 1) < 0)
 			return -1;
-		*(volatile unsigned int *)adr = val;
+		writel(val, adr);
 	}
 	return 0;
 }
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/7] netX: add the 'th link' platform
  2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
                   ` (5 preceding siblings ...)
  2012-04-27  9:32 ` [PATCH 6/7] netX: don't bother with variable sizes, use the intend Juergen Beisert
@ 2012-04-27  9:32 ` Juergen Beisert
  2012-04-30 11:46   ` Sascha Hauer
  6 siblings, 1 reply; 9+ messages in thread
From: Juergen Beisert @ 2012-04-27  9:32 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/Makefile                               |    1 +
 arch/arm/boards/netx-th-link/Makefile           |    1 +
 arch/arm/boards/netx-th-link/config.h           |    4 +
 arch/arm/boards/netx-th-link/env/config         |   48 ++++++
 arch/arm/boards/netx-th-link/netx-th-link.c     |  178 +++++++++++++++++++++++
 arch/arm/configs/hilscher_netX_thlink_defconfig |   39 +++++
 arch/arm/mach-netx/Kconfig                      |   13 ++
 arch/arm/tools/mach-types                       |    1 +
 8 files changed, 285 insertions(+)
 create mode 100644 arch/arm/boards/netx-th-link/Makefile
 create mode 100644 arch/arm/boards/netx-th-link/config.h
 create mode 100644 arch/arm/boards/netx-th-link/env/config
 create mode 100644 arch/arm/boards/netx-th-link/netx-th-link.c
 create mode 100644 arch/arm/configs/hilscher_netX_thlink_defconfig

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d0bfd71..0c0762c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -96,6 +96,7 @@ board-$(CONFIG_MACH_MMCCPU)			:= mmccpu
 board-$(CONFIG_MACH_MX1ADS)			:= mx1ads
 board-$(CONFIG_MACH_NOMADIK_8815NHK)		:= nhk8815
 board-$(CONFIG_MACH_NXDB500)			:= netx
+board-$(CONFIG_MACH_NETXTHLINK)			:= netx-th-link
 board-$(CONFIG_MACH_OMAP343xSDP)		:= omap343xdsp
 board-$(CONFIG_MACH_BEAGLE)			:= beagle
 board-$(CONFIG_MACH_OMAP3EVM)			:= omap3evm
diff --git a/arch/arm/boards/netx-th-link/Makefile b/arch/arm/boards/netx-th-link/Makefile
new file mode 100644
index 0000000..4aaf64c
--- /dev/null
+++ b/arch/arm/boards/netx-th-link/Makefile
@@ -0,0 +1 @@
+obj-y += netx-th-link.o
diff --git a/arch/arm/boards/netx-th-link/config.h b/arch/arm/boards/netx-th-link/config.h
new file mode 100644
index 0000000..ca15136
--- /dev/null
+++ b/arch/arm/boards/netx-th-link/config.h
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
diff --git a/arch/arm/boards/netx-th-link/env/config b/arch/arm/boards/netx-th-link/env/config
new file mode 100644
index 0000000..bed10b5
--- /dev/null
+++ b/arch/arm/boards/netx-th-link/env/config
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+machine=th-link
+eth0.serverip=
+user=
+
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
+ip=dhcp
+dhcp_vendor_id=barebox
+
+# 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 'tftp', 'nfs', 'nor'
+kernel_loc=nor
+# can be either 'net', 'nor' or 'initrd'
+rootfs_loc=nor
+
+# for flash based rootfs: 'jffs2' or 'ubifs'
+rootfs_type=jffs2
+rootfsimage=rootfs-${machine}.$rootfs_type
+
+kernelimage=zImage-$machine
+#kernelimage=uImage-$machine
+#kernelimage=Image-$machine
+#kernelimage=Image-$machine.lzo
+
+if [ -n $user ]; then
+	kernelimage="$user"-"$kernelimage"
+	rootfsimage="$user"-"$rootfsimage"
+	nfsroot="/home/$user/nfsroot/$machine"
+else
+	nfsroot="/path/to/your/nfsroot"
+fi
+
+# used in the "netconsole" case
+autoboot_timeout=3
+
+# no way to output anything
+bootargs="quite"
+
+# the NOR is 192 MiB (not! 256 MiB!)
+nor_parts="256k(barebox)ro,256k(bareboxenv),3072k(kernel),193024k(root)"
+rootfs_mtdblock_nor=3
diff --git a/arch/arm/boards/netx-th-link/netx-th-link.c b/arch/arm/boards/netx-th-link/netx-th-link.c
new file mode 100644
index 0000000..dceef83
--- /dev/null
+++ b/arch/arm/boards/netx-th-link/netx-th-link.c
@@ -0,0 +1,178 @@
+/*
+ * (C) Copyright 2012 Juergen Beisert <kernel@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.
+ *
+ *
+ * Hilscher's TH-Link Eth system
+ * -----------------------------
+ *
+ * This board is based on a Hilscher's netX-100 ARM CPU and contains
+ *  - 256 MiB SDRAM (64 MiB @ 32 bit)
+ *  - 256 MiB Flash (192 MiB @ 32 bit)
+ *
+ * Specific to the CPU is, it does not require any setup code to bring the
+ * SDRAM up and working. This is done in a bootloader contained in ROM.
+ *
+ * Specific for the TH-Link is it has no serial console. Only the JTAG
+ * based 'DCC' console is possible or a 'netconsole'.
+ *
+ */
+
+#include <common.h>
+#include <init.h>
+#include <net.h>
+#include <sizes.h>
+#include <io.h>
+#include <partition.h>
+#include <asm/armlinux.h>
+#include <fs.h>
+#include <generated/mach-types.h>
+#include <mach/netx-devices.h>
+#include <mach/netx-eth.h>
+#include <mach/netx-cm.h>
+
+static struct netx_eth_platform_data th_link_eth0_data = {
+	.xcno = 0,
+};
+
+static struct netx_eth_platform_data th_link_eth1_data = {
+	.xcno = 1,
+};
+
+#define GPIO_LOW 0x0
+#define GPIO_HIGH CFG_MODE_INPUT_CAPTURE_CONT_RISING
+
+/*
+ * GPIO usage:
+ * ------------------------
+ * GPIO0 not used, external 10k pullup
+ * GPIO1 not used and not connected anywhere
+ * GPIO2 not used, external 10k pullup
+ * GPIO[3..9] are not used and not connected anywhere
+ * GPIO10 interrupt input for the RTC
+ * GPIO[11..14] are not used and not connected anywhere
+ * GPIO15 is the CD (change detect) input of the SD card slot
+*/
+static void th_link_init_gpio(void)
+{
+	/* switch all not connected pins to output and high level */
+	GPIO_REG(GPIO_CFG(0)) = CFG_IOCFG_GP_UART;
+	GPIO_REG(GPIO_CFG(1)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(2)) = CFG_IOCFG_GP_UART;
+	GPIO_REG(GPIO_CFG(3)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(4)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(5)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(6)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(7)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(8)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(9)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(10)) = CFG_IOCFG_GP_INPUT | CFG_MODE_INPUT_READ;
+	GPIO_REG(GPIO_CFG(11)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(12)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(13)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(14)) = CFG_IOCFG_GP_OUTPUT | GPIO_HIGH;
+	GPIO_REG(GPIO_CFG(15)) = CFG_IOCFG_GP_INPUT | CFG_MODE_INPUT_READ;
+}
+
+/*
+ * PIO usage:
+ * ------------------------
+ * PIO0 is the COM0/RED LED (low = LED on)
+ * PIO1 is the COM0/GREEN LED (low = LED on)
+ * PIO2 is the COM1/RED LED (low = LED on)
+ * PIO3 is the COM1/GREEN LED (low = LED on)
+ * PIO[4..30] are not used and not connected anywhere
+ */
+static void th_link_init_pio(void)
+{
+	/* switch all not connected pins to output and high level */
+	NETX_PIO_OUTPIO = 0x7fffffff;	/* all LEDs off */
+	NETX_PIO_OEPIO = 0x7fffffff;
+}
+
+/*
+ * HIFPIO usage:
+ * -------------------------------
+ * HIFPIO32 Relais control (low = off)
+ * HIFPIO[33..84] are not used and not connected anywhere
+ */
+static void th_link_init_hifpio(void)
+{
+	u32 reg, key;
+
+	/*
+	 * to be able to use these pins as PIOs, we must
+	 * activate them globally first
+	 */
+	reg = SYSTEM_REG(SYSTEM_IOC_CR) & ~0x80000000;
+	/* enable write access to the IO_CFG register */
+	key = SYSTEM_REG(SYSTEM_IOC_ACCESS_KEY);
+	SYSTEM_REG(SYSTEM_IOC_ACCESS_KEY) = key;
+	/* do the write now */
+	SYSTEM_REG(SYSTEM_IOC_CR) = reg;
+
+	/* we now can activate PIO mode at these pins */
+	reg = NETX_DPMAS_IF_CONF0_REG & ~(0x7 << 28);
+	NETX_DPMAS_IF_CONF0_REG = reg | IF_CONF0_HIF_IO;
+
+	/* switch all not connected pins to output and high level */
+	NETX_DPMAS_DATA1_REG = 0xfffff;
+	NETX_DPMAS_DRV_EN1_REG = 0xfffff;
+	NETX_DPMAS_IO_MODE1_REG = 0x00000; /* all PIO Mode */
+
+	NETX_DPMAS_DATA0_REG = 0xfffffffe;
+	NETX_DPMAS_DRV_EN0_REG = 0xffffffff;
+	NETX_DPMAS_IO_MODE0_REG = 0x00000000; /* all PIO Mode */
+}
+
+#define FLASH_ACCESS_TIMING 0x0203030F
+
+static int th_link_devices_init(void)
+{
+	th_link_init_gpio();
+	th_link_init_pio();
+	th_link_init_hifpio();
+
+	/*
+	 * the ROM code only sets up the CS0 line,
+	 * we need here to enable the CS1 and CS2 lines as well, to get
+	 * access to all three 64 MiB windows into the flash
+	 */
+	writel(FLASH_ACCESS_TIMING, NETX_PA_MEMCR); /* CS0, paranoia */
+	writel(FLASH_ACCESS_TIMING, NETX_PA_MEMCR + 4); /* CS1 */
+	writel(FLASH_ACCESS_TIMING, NETX_PA_MEMCR + 8); /* CS2 */
+
+	/* 256 MiB flash, but only 192 MiB can be really accessed */
+	netx_add_pflash(192 * SZ_1M);
+
+	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
+	/* Do not overwrite primary env for now */
+	devfs_add_partition("nor0", 0x40000, 0x40000, PARTITION_FIXED, "env0");
+
+	protect_file("/dev/env0", 1);
+
+	netx_add_eth0(&th_link_eth0_data);
+	netx_add_eth1(&th_link_eth1_data);
+
+	armlinux_set_bootparams((void *)NETX_SDRAM_BASE + 0x100);
+	armlinux_set_architecture(MACH_TYPE_THLINK_ETH);
+
+	return 0;
+}
+device_initcall(th_link_devices_init);
+
+static int th_link_mem_init(void)
+{
+	arm_add_mem_device("ram0", NETX_SDRAM_BASE, SZ_256M);
+	return 0;
+}
+mem_initcall(th_link_mem_init);
diff --git a/arch/arm/configs/hilscher_netX_thlink_defconfig b/arch/arm/configs/hilscher_netX_thlink_defconfig
new file mode 100644
index 0000000..654600a
--- /dev/null
+++ b/arch/arm/configs/hilscher_netX_thlink_defconfig
@@ -0,0 +1,39 @@
+CONFIG_ARCH_NETX=y
+CONFIG_MACH_NETXTHLINK=y
+CONFIG_AEABI=y
+CONFIG_TEXT_BASE=0x81f00000
+CONFIG_BROKEN=y
+CONFIG_PROMPT="th-link:"
+CONFIG_LONGHELP=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_PARTITION=y
+CONFIG_PARTITION_DISK=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/netx-th-link/env"
+CONFIG_DEBUG_INFO=y
+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_MEMINFO=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_PARTITION=y
+CONFIG_NET=y
+CONFIG_NET_DHCP=y
+CONFIG_NET_NFS=y
+CONFIG_NET_PING=y
+CONFIG_NET_TFTP=y
+CONFIG_NET_NETCONSOLE=y
+# CONFIG_DRIVER_SERIAL_NETX is not set
+CONFIG_DRIVER_NET_NETX=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_INTEL is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_2 is not set
+CONFIG_CFI_BUFFER_WRITE=y
diff --git a/arch/arm/mach-netx/Kconfig b/arch/arm/mach-netx/Kconfig
index 8e83417..a0d621a 100644
--- a/arch/arm/mach-netx/Kconfig
+++ b/arch/arm/mach-netx/Kconfig
@@ -3,9 +3,11 @@ if ARCH_NETX
 config ARCH_TEXT_BASE
 	hex
 	default 0x81f00000 if MACH_NXDB500
+	default 0x83f00000 if MACH_NETXTHLINK
 
 config BOARDINFO
 	default "Hilscher Netx nxdb500" if MACH_NXDB500
+	default "Hilscher TH-LINK"     if MACH_NETXTHLINK
 
 config NETX_SDRAM_CTRL
 	hex
@@ -14,6 +16,7 @@ config NETX_SDRAM_CTRL
 	default 0x030D0111 if MACH_NXHMIBB
 	default 0x010D0111 if MACH_NXEB500HMI
 	default 0x030D0001 if MACH_NXHX
+	default 0x030D0321 if MACH_NETXTHLINK
 
 config NETX_SDRAM_TIMING_CTRL
 	hex
@@ -22,6 +25,7 @@ config NETX_SDRAM_TIMING_CTRL
 	default 0x03C13251 if MACH_NXHMIBB
 	default 0x03C13251 if MACH_NXEB500HMI
 	default 0x03C23251 if MACH_NXHX
+	default 0x02b13251 if MACH_NETXTHLINK
 
 config NETX_MEM_CTRL
 	hex
@@ -30,6 +34,7 @@ config NETX_MEM_CTRL
 	default 0x0103030F if MACH_NXHMIBB
 	default 0x0103030F if MACH_NXEB500HMI
 	default 0x0103030F if MACH_NXHX
+	default 0x0203030F if MACH_NETXTHLINK
 
 config NETX_COOKIE
 	hex
@@ -38,6 +43,7 @@ config NETX_COOKIE
 	default 16 if MACH_NXHMIBB
 	default 16 if MACH_NXEB500HMI
 	default 16 if MACH_NXHX
+	default 32 if MACH_NETXTHLINK
 
 choice
 
@@ -51,6 +57,13 @@ config MACH_NXDB500
 	help
 	  Say Y here if you are using the Hilscher Netx nxdb500 board
 
+config MACH_NETXTHLINK
+	bool "Hilscher TH-Link"
+	select HAS_NETX_ETHER
+	select HAS_CFI
+	help
+	  Say Y here if you are using the Hilscher TH-Link platform
+
 endchoice
 
 endif
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index ff97af4..f958ee6 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -3963,3 +3963,4 @@ pcats_9307_type_a	MACH_PCATS_9307_TYPE_A	PCATS_9307_TYPE_A	4008
 pcats_9307_type_o	MACH_PCATS_9307_TYPE_O	PCATS_9307_TYPE_O	4009
 pcats_9307_type_r	MACH_PCATS_9307_TYPE_R	PCATS_9307_TYPE_R	4010
 streamplug		MACH_STREAMPLUG		STREAMPLUG		4011
+th_link_eth		MACH_THLINK_ETH	 	THLINK_ETH		4156
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 7/7] netX: add the 'th link' platform
  2012-04-27  9:32 ` [PATCH 7/7] netX: add the 'th link' platform Juergen Beisert
@ 2012-04-30 11:46   ` Sascha Hauer
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2012-04-30 11:46 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

On Fri, Apr 27, 2012 at 11:32:25AM +0200, Juergen Beisert wrote:
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> ---
> diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
> index ff97af4..f958ee6 100644
> --- a/arch/arm/tools/mach-types
> +++ b/arch/arm/tools/mach-types
> @@ -3963,3 +3963,4 @@ pcats_9307_type_a	MACH_PCATS_9307_TYPE_A	PCATS_9307_TYPE_A	4008
>  pcats_9307_type_o	MACH_PCATS_9307_TYPE_O	PCATS_9307_TYPE_O	4009
>  pcats_9307_type_r	MACH_PCATS_9307_TYPE_R	PCATS_9307_TYPE_R	4010
>  streamplug		MACH_STREAMPLUG		STREAMPLUG		4011
> +th_link_eth		MACH_THLINK_ETH	 	THLINK_ETH		4156

No manual patching of this file please.

I applied the other patches from this series.

Thanks
 Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-04-30 11:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-27  9:32 [PATCH] netX: fixes, cleanups, helpers and a new platform: THLINK-ETH Juergen Beisert
2012-04-27  9:32 ` [PATCH 1/7] netX: add a few base addresses for non on chip devices Juergen Beisert
2012-04-27  9:32 ` [PATCH 2/7] netX: unify the device registration Juergen Beisert
2012-04-27  9:32 ` [PATCH 3/7] netX: UART may not initialize correctly Juergen Beisert
2012-04-27  9:32 ` [PATCH 4/7] netX/network: fix debug outputs Juergen Beisert
2012-04-27  9:32 ` [PATCH 5/7] netX: XPEC firmware is always of attribute const Juergen Beisert
2012-04-27  9:32 ` [PATCH 6/7] netX: don't bother with variable sizes, use the intend Juergen Beisert
2012-04-27  9:32 ` [PATCH 7/7] netX: add the 'th link' platform Juergen Beisert
2012-04-30 11:46   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox