[V2 1/5] powerpc: dts: klondike: Add AHB, APB bus; remove OPB bus

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

10 messages, 2 authors, 2012-05-21 · open the first message on its own page

[V2 1/5] powerpc: dts: klondike: Add AHB, APB bus; remove OPB bus

From: Tanmay Inamdar <hidden>
Date: 2012-04-09 07:21:32

Add entries in klondike device tree for AHB and APB bus and remove entry for
non-existent OPB bus inherited from legacy code.

Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 8c94290... 4ff2852... M	arch/powerpc/boot/dts/klondike.dts
 arch/powerpc/boot/dts/klondike.dts |  167 ++++++++++++++++++-----------------
 1 files changed, 86 insertions(+), 81 deletions(-)
diff --git a/arch/powerpc/boot/dts/klondike.dts b/arch/powerpc/boot/dts/klondike.dts
index 8c94290..4ff2852 100644
--- a/arch/powerpc/boot/dts/klondike.dts
+++ b/arch/powerpc/boot/dts/klondike.dts
@@ -132,96 +132,101 @@
 					/*RXDE*/  0x3 0x4>;
 		};
 
-		POB0: opb {
-			compatible = "ibm,opb";
-			#address-cells = <1>;
-			#size-cells = <1>;
-			ranges = <0x20000000 0x20000000 0x30000000
-				  0x50000000 0x50000000 0x10000000
-				  0x60000000 0x60000000 0x10000000
-				  0xFE000000 0xFE000000 0x00010000>;
-			dcr-reg = <0x100 0x020>;
-			clock-frequency = <300000000>; /* Filled in by U-Boot */
+		RGMII0: emac-rgmii@400a2000 {
+			compatible = "ibm,rgmii";
+			reg = <0x400a2000 0x00000010>;
+			has-mdio;
+		};
 
-			RGMII0: emac-rgmii@400a2000 {
-				compatible = "ibm,rgmii";
-				reg = <0x400a2000 0x00000010>;
-				has-mdio;
-			};
+		TAH0: emac-tah@400a3000 {
+			compatible = "ibm,tah";
+			reg = <0x400a3000 0x100>;
+		};
 
-			TAH0: emac-tah@400a3000 {
-				compatible = "ibm,tah";
-				reg = <0x400a3000 0x100>;
-			};
+		TAH1: emac-tah@400a4000 {
+			compatible = "ibm,tah";
+			reg = <0x400a4000 0x100>;
+		};
 
-			TAH1: emac-tah@400a4000 {
-				compatible = "ibm,tah";
-				reg = <0x400a4000 0x100>;
-			};
+		EMAC0: ethernet@400a0000 {
+			compatible = "ibm,emac4", "ibm-emac4sync";
+			interrupt-parent = <&EMAC0>;
+			interrupts = <0x0>;
+			#interrupt-cells = <1>;
+			#address-cells = <0>;
+			#size-cells = <0>;
+			interrupt-map = </*Status*/ 0x0 &UIC0 0x13 0x4>;
+			reg = <0x400a0000 0x00000100>;
+			local-mac-address = [000000000000]; /* Filled in by U-Boot */
+			mal-device = <&MAL0>;
+			mal-tx-channel = <0x0>;
+			mal-rx-channel = <0x0>;
+			cell-index = <0>;
+			max-frame-size = <9000>;
+			rx-fifo-size = <4096>;
+			tx-fifo-size = <2048>;
+			phy-mode = "rgmii";
+			phy-address = <0x2>;
+			turbo = "no";
+			phy-map = <0x00000000>;
+			rgmii-device = <&RGMII0>;
+			rgmii-channel = <0>;
+			tah-device = <&TAH0>;
+			tah-channel = <0>;
+			has-inverted-stacr-oc;
+			has-new-stacr-staopc;
+		};
 
-			EMAC0: ethernet@400a0000 {
-				compatible = "ibm,emac4", "ibm-emac4sync";
-				interrupt-parent = <&EMAC0>;
-				interrupts = <0x0>;
-				#interrupt-cells = <1>;
-				#address-cells = <0>;
-				#size-cells = <0>;
-				interrupt-map = </*Status*/ 0x0 &UIC0 0x13 0x4>;
-				reg = <0x400a0000 0x00000100>;
-				local-mac-address = [000000000000]; /* Filled in by U-Boot */
-				mal-device = <&MAL0>;
-				mal-tx-channel = <0x0>;
-				mal-rx-channel = <0x0>;
-				cell-index = <0>;
-				max-frame-size = <9000>;
-				rx-fifo-size = <4096>;
-				tx-fifo-size = <2048>;
-				phy-mode = "rgmii";
-				phy-address = <0x2>;
-				turbo = "no";
-				phy-map = <0x00000000>;
-				rgmii-device = <&RGMII0>;
-				rgmii-channel = <0>;
-				tah-device = <&TAH0>;
-				tah-channel = <0>;
-				has-inverted-stacr-oc;
-				has-new-stacr-staopc;
-			};
+		EMAC1: ethernet@400a1000 {
+			compatible = "ibm,emac4", "ibm-emac4sync";
+			status = "disabled";
+			interrupt-parent = <&EMAC1>;
+			interrupts = <0x0>;
+			#interrupt-cells = <1>;
+			#address-cells = <0>;
+			#size-cells = <0>;
+			interrupt-map = </*Status*/ 0x0 &UIC0 0x14 0x4>;
+			reg = <0x400a1000 0x00000100>;
+			local-mac-address = [000000000000]; /* Filled in by U-Boot */
+			mal-device = <&MAL0>;
+			mal-tx-channel = <1>;
+			mal-rx-channel = <8>;
+			cell-index = <1>;
+			max-frame-size = <9000>;
+			rx-fifo-size = <4096>;
+			tx-fifo-size = <2048>;
+			phy-mode = "rgmii";
+			phy-address = <0x3>;
+			turbo = "no";
+			phy-map = <0x00000000>;
+			rgmii-device = <&RGMII0>;
+			rgmii-channel = <1>;
+			tah-device = <&TAH1>;
+			tah-channel = <0>;
+			has-inverted-stacr-oc;
+			has-new-stacr-staopc;
+			mdio-device = <&EMAC0>;
+		};
 
-			EMAC1: ethernet@400a1000 {
-				compatible = "ibm,emac4", "ibm-emac4sync";
-				status = "disabled";
-				interrupt-parent = <&EMAC1>;
-				interrupts = <0x0>;
-				#interrupt-cells = <1>;
-				#address-cells = <0>;
-				#size-cells = <0>;
-				interrupt-map = </*Status*/ 0x0 &UIC0 0x14 0x4>;
-				reg = <0x400a1000 0x00000100>;
-				local-mac-address = [000000000000]; /* Filled in by U-Boot */
-				mal-device = <&MAL0>;
-				mal-tx-channel = <1>;
-				mal-rx-channel = <8>;
-				cell-index = <1>;
-				max-frame-size = <9000>;
-				rx-fifo-size = <4096>;
-				tx-fifo-size = <2048>;
-				phy-mode = "rgmii";
-				phy-address = <0x3>;
-				turbo = "no";
-				phy-map = <0x00000000>;
-				rgmii-device = <&RGMII0>;
-				rgmii-channel = <1>;
-				tah-device = <&TAH1>;
-				tah-channel = <0>;
-				has-inverted-stacr-oc;
-				has-new-stacr-staopc;
-				mdio-device = <&EMAC0>;
+		AHB: ahb {
+			compatible = "apm,ahb";
+			dcr-reg = <0xc 0x2>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			clock-frequency = <0>; /* Filled in by U-Boot */
+
+			APB: apb {
+				compatible = "apm,apb";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges;
+				clock-frequency = <0>;
 			};
 		};
 	};
 
 	chosen {
-		linux,stdout-path = "/plb/opb/serial@50001000";
+		linux,stdout-path = "/plb/ahb/apb/serial@50001000";
 	};
 };
-- 
1.6.1.rc3

[V2 2/5] powerpc: 40x: Add AHB, APB of_device_ids

From: Tanmay Inamdar <hidden>
Date: 2012-04-09 07:21:31

Adding of_device_id's for AHB and APB buses used in klondike (APM8018X) in
platforms/40x/ppc40x_simple.c file

Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 9761206... 7b518ed... M	arch/powerpc/platforms/40x/ppc40x_simple.c
 arch/powerpc/platforms/40x/ppc40x_simple.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 9761206..7b518ed 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -29,6 +29,8 @@ static __initdata struct of_device_id ppc40x_of_bus[] = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
+	{ .compatible = "apm,ahb", },
+	{ .compatible = "apm,apb", },
 	{ .compatible = "simple-bus", },
 	{},
 };
-- 
1.6.1.rc3

[V2 3/5] powerpc: dts: klondike: Add UART nodes

From: Tanmay Inamdar <hidden>
Date: 2012-04-09 07:21:37

Adding UART nodes in Klondike device tree file.

Version 2:
Removed unnecessary 'virtual-reg' property from UART node.

Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 4ff2852... b1e516e... M	arch/powerpc/boot/dts/klondike.dts
 arch/powerpc/boot/dts/klondike.dts |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/klondike.dts b/arch/powerpc/boot/dts/klondike.dts
index 4ff2852..b1e516e 100644
--- a/arch/powerpc/boot/dts/klondike.dts
+++ b/arch/powerpc/boot/dts/klondike.dts
@@ -222,6 +222,28 @@
 				#size-cells = <1>;
 				ranges;
 				clock-frequency = <0>;
+
+				UART0: serial@50001000 {
+				       device_type = "serial";
+				       compatible = "ns16550";
+				       reg = <0x50001000 0x00000100>;
+				       clock-frequency = <0>; /* Filled in by U-Boot */
+				       current-speed = <115200>;
+				       interrupt-parent = <&UIC0>;
+				       interrupts = <0x0 0x4>;
+				       reg-shift = <2>;
+				};
+
+				UART1: serial@50002000 {
+				       device_type = "serial";
+				       compatible = "ns16550";
+				       reg = <0x50002000 0x00000100>;
+				       clock-frequency = <0>; /* Filled in by U-Boot */
+				       current-speed = <115200>;
+				       interrupt-parent = <&UIC0>;
+				       interrupts = <0x1 0x4>;
+				       reg-shift = <2>;
+			       };
 			};
 		};
 	};
-- 
1.6.1.rc3

[V2 4/5] powerpc: config: 40x: Add 16650 UART support in klondike defconfig

From: Tanmay Inamdar <hidden>
Date: 2012-04-09 07:21:43

Adding 16650 UART support in klondike_defconfig for APM8018X SOC

Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 c0d228d... c35c345... M	arch/powerpc/configs/40x/klondike_defconfig
 arch/powerpc/configs/40x/klondike_defconfig |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/configs/40x/klondike_defconfig b/arch/powerpc/configs/40x/klondike_defconfig
index c0d228d..c35c345 100644
--- a/arch/powerpc/configs/40x/klondike_defconfig
+++ b/arch/powerpc/configs/40x/klondike_defconfig
@@ -30,6 +30,12 @@ CONFIG_SCSI_SAS_ATTRS=y
 # CONFIG_UNIX98_PTYS is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
 # CONFIG_USB_SUPPORT is not set
-- 
1.6.1.rc3

[V2 5/5] powerpc: kernel: 16650 UART reg-shift support

From: Tanmay Inamdar <hidden>
Date: 2012-04-09 07:22:06

In APM8018X SOC, UART register address space has been relocated to 32-bit
data boundaries for APB bus implementation.
Current legacy_serial driver ignores the reg-shift property. This patch
modifies legacy_serial.c and udbg_16550.c to work with above mentioned UARTs.

Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 8338aef... f5fc106... M	arch/powerpc/include/asm/udbg.h
:100644 100644 bedd12e... d523b7d... M	arch/powerpc/kernel/legacy_serial.c
:100644 100644 6837f83... e0cb7dc... M	arch/powerpc/kernel/udbg_16550.c
 arch/powerpc/include/asm/udbg.h     |    2 +-
 arch/powerpc/kernel/legacy_serial.c |   16 +++++---
 arch/powerpc/kernel/udbg_16550.c    |   64 ++++++++++++++++++++++------------
 3 files changed, 52 insertions(+), 30 deletions(-)
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 8338aef..f5fc106 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -29,7 +29,7 @@ extern void udbg_printf(const char *fmt, ...)
 extern void udbg_progress(char *s, unsigned short hex);
 
 extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
-			   unsigned int clock);
+			   unsigned int clock,  unsigned int regshift);
 extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
 					  unsigned int clock);
 
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index bedd12e..d523b7d 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -33,6 +33,7 @@ static struct legacy_serial_info {
 	unsigned int			clock;
 	int				irq_check_parent;
 	phys_addr_t			taddr;
+	unsigned int			regshift;
 } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
 
 static struct __initdata of_device_id legacy_serial_parents[] = {
@@ -42,6 +43,7 @@ static struct __initdata of_device_id legacy_serial_parents[] = {
 	{.compatible = "ibm,opb",},
 	{.compatible = "simple-bus",},
 	{.compatible = "wrs,epld-localbus",},
+	{.compatible = "apm,apb",},
 	{},
 };
 
@@ -163,11 +165,6 @@ static int __init add_legacy_soc_port(struct device_node *np,
 	if (of_get_property(np, "clock-frequency", NULL) == NULL)
 		return -1;
 
-	/* if reg-shift or offset, don't try to use it */
-	if ((of_get_property(np, "reg-shift", NULL) != NULL) ||
-		(of_get_property(np, "reg-offset", NULL) != NULL))
-		return -1;
-
 	/* if rtas uses this device, don't try to use it as well */
 	if (of_get_property(np, "used-by-rtas", NULL) != NULL)
 		return -1;
@@ -319,7 +316,7 @@ static void __init setup_legacy_serial_console(int console)
 	if (info->speed == 0)
 		info->speed = udbg_probe_uart_speed(addr, info->clock);
 	DBG("default console speed = %d\n", info->speed);
-	udbg_init_uart(addr, info->speed, info->clock);
+	udbg_init_uart(addr, info->speed, info->clock, info->regshift);
 }
 
 /*
@@ -336,6 +333,7 @@ void __init find_legacy_serial_ports(void)
 	struct device_node *np, *stdout = NULL;
 	const char *path;
 	int index;
+	unsigned int regshift;
 
 	DBG(" -> find_legacy_serial_port()\n");
 
@@ -359,6 +357,12 @@ void __init find_legacy_serial_ports(void)
 				index = add_legacy_soc_port(np, np);
 				if (index >= 0 && np == stdout)
 					legacy_serial_console = index;
+				if (of_property_read_u32(np, "reg-shift",
+							&regshift) == 0) {
+					legacy_serial_infos
+					[legacy_serial_console].regshift =
+								regshift;
+				}
 			}
 		}
 		of_node_put(parent);
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 6837f83..e0cb7dc 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -47,12 +47,29 @@ struct NS16550 {
 
 #define LCR_DLAB 0x80
 
+static unsigned int reg_shift;
+#define ns16550_offset(addr) (addr - (unsigned char *)udbg_comport)
+
 static struct NS16550 __iomem *udbg_comport;
 
+static inline u8 serial_read(unsigned char *addr)
+{
+	u32 offset = ns16550_offset(addr) << reg_shift;
+	return readb(udbg_comport + offset);
+}
+
+static inline void serial_write(unsigned char *addr, char val)
+{
+	u32 offset = ns16550_offset(addr) << reg_shift;
+	writeb(val, udbg_comport + offset);
+}
+
 static void udbg_550_flush(void)
 {
+	u32 timeout = 1000;
 	if (udbg_comport) {
-		while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
+		while (((serial_read(&udbg_comport->lsr) & LSR_THRE) == 0)
+							&& --timeout)
 			/* wait for idle */;
 	}
 }
@@ -63,15 +80,15 @@ static void udbg_550_putc(char c)
 		if (c == '\n')
 			udbg_550_putc('\r');
 		udbg_550_flush();
-		out_8(&udbg_comport->thr, c);
+		serial_write(&udbg_comport->thr, c);
 	}
 }
 
 static int udbg_550_getc_poll(void)
 {
 	if (udbg_comport) {
-		if ((in_8(&udbg_comport->lsr) & LSR_DR) != 0)
-			return in_8(&udbg_comport->rbr);
+		if ((serial_read(&udbg_comport->lsr) & LSR_DR) != 0)
+			return serial_read(&udbg_comport->rbr);
 		else
 			return -1;
 	}
@@ -81,15 +98,15 @@ static int udbg_550_getc_poll(void)
 static int udbg_550_getc(void)
 {
 	if (udbg_comport) {
-		while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
+		while ((serial_read(&udbg_comport->lsr) & LSR_DR) == 0)
 			/* wait for char */;
-		return in_8(&udbg_comport->rbr);
+		return serial_read(&udbg_comport->rbr);
 	}
 	return -1;
 }
 
 void udbg_init_uart(void __iomem *comport, unsigned int speed,
-		    unsigned int clock)
+		    unsigned int clock, unsigned int regshift)
 {
 	unsigned int dll, base_bauds;
 
@@ -103,22 +120,23 @@ void udbg_init_uart(void __iomem *comport, unsigned int speed,
 
 	if (comport) {
 		udbg_comport = (struct NS16550 __iomem *)comport;
-		out_8(&udbg_comport->lcr, 0x00);
-		out_8(&udbg_comport->ier, 0xff);
-		out_8(&udbg_comport->ier, 0x00);
-		out_8(&udbg_comport->lcr, LCR_DLAB);
-		out_8(&udbg_comport->dll, dll & 0xff);
-		out_8(&udbg_comport->dlm, dll >> 8);
+		serial_write(&udbg_comport->lcr, 0x00);
+		serial_write(&udbg_comport->ier, 0xff);
+		serial_write(&udbg_comport->ier, 0x00);
+		serial_write(&udbg_comport->lcr, LCR_DLAB);
+		serial_write(&udbg_comport->dll, dll & 0xff);
+		serial_write(&udbg_comport->dlm, dll >> 8);
 		/* 8 data, 1 stop, no parity */
-		out_8(&udbg_comport->lcr, 0x03);
+		serial_write(&udbg_comport->lcr, 0x03);
 		/* RTS/DTR */
-		out_8(&udbg_comport->mcr, 0x03);
+		serial_write(&udbg_comport->mcr, 0x03);
 		/* Clear & enable FIFOs */
-		out_8(&udbg_comport->fcr ,0x07);
+		serial_write(&udbg_comport->fcr, 0x07);
 		udbg_putc = udbg_550_putc;
 		udbg_flush = udbg_550_flush;
 		udbg_getc = udbg_550_getc;
 		udbg_getc_poll = udbg_550_getc_poll;
+		reg_shift = regshift;
 	}
 }
 
@@ -128,24 +146,24 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
 	u8 old_lcr;
 	struct NS16550 __iomem *port = comport;
 
-	old_lcr = in_8(&port->lcr);
+	old_lcr = serial_read(&port->lcr);
 
 	/* select divisor latch registers.  */
-	out_8(&port->lcr, LCR_DLAB);
+	serial_write(&port->lcr, LCR_DLAB);
 
 	/* now, read the divisor */
-	dll = in_8(&port->dll);
-	dlm = in_8(&port->dlm);
+	dll = serial_read(&port->dll);
+	dlm = serial_read(&port->dlm);
 	divisor = dlm << 8 | dll;
 
 	/* check prescaling */
-	if (in_8(&port->mcr) & 0x80)
+	if (serial_read(&port->mcr) & 0x80)
 		prescaler = 4;
 	else
 		prescaler = 1;
 
 	/* restore the LCR */
-	out_8(&port->lcr, old_lcr);
+	serial_write(&port->lcr, old_lcr);
 
 	/* calculate speed */
 	speed = (clock / prescaler) / (divisor * 16);
@@ -341,7 +359,7 @@ void __init udbg_init_wsp(void)
 {
 	udbg_comport = (struct NS16550 __iomem *)WSP_UART_VIRT;
 
-	udbg_init_uart(udbg_comport, 57600, 50000000);
+	udbg_init_uart(udbg_comport, 57600, 50000000, 0);
 
 	udbg_putc = udbg_wsp_putc;
 	udbg_flush = udbg_wsp_flush;
-- 
1.6.1.rc3

Re: [V2 5/5] powerpc: kernel: 16650 UART reg-shift support

From: Josh Boyer <hidden>
Date: 2012-05-02 13:38:16

On Mon, Apr 9, 2012 at 3:20 AM, Tanmay Inamdar [off-list ref] wrote:
In APM8018X SOC, UART register address space has been relocated to 32-bit
data boundaries for APB bus implementation.
Current legacy_serial driver ignores the reg-shift property. This patch
modifies legacy_serial.c and udbg_16550.c to work with above mentioned UA=
RTs.
Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 8338aef... f5fc106... M =A0arch/powerpc/include/asm/udbg.h
:100644 100644 bedd12e... d523b7d... M =A0arch/powerpc/kernel/legacy_seri=
al.c
:100644 100644 6837f83... e0cb7dc... M =A0arch/powerpc/kernel/udbg_16550.=
c
=A0arch/powerpc/include/asm/udbg.h =A0 =A0 | =A0 =A02 +-
=A0arch/powerpc/kernel/legacy_serial.c | =A0 16 +++++---
=A0arch/powerpc/kernel/udbg_16550.c =A0 =A0| =A0 64 +++++++++++++++++++++=
+------------
quoted hunk
=A03 files changed, 52 insertions(+), 30 deletions(-)
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/u=
dbg.h
quoted hunk
index 8338aef..f5fc106 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -29,7 +29,7 @@ extern void udbg_printf(const char *fmt, ...)
=A0extern void udbg_progress(char *s, unsigned short hex);

=A0extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock, =
=A0unsigned int regshift);
=A0extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0unsigned int clock);
quoted hunk
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/le=
gacy_serial.c
quoted hunk
index bedd12e..d523b7d 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -33,6 +33,7 @@ static struct legacy_serial_info {
=A0 =A0 =A0 =A0unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0clock;
=A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 irq_check_parent;
=A0 =A0 =A0 =A0phys_addr_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 taddr;
+ =A0 =A0 =A0 unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regshif=
t;
quoted hunk
=A0} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];

=A0static struct __initdata of_device_id legacy_serial_parents[] =3D {
@@ -42,6 +43,7 @@ static struct __initdata of_device_id legacy_serial_par=
ents[] =3D {
quoted hunk
=A0 =A0 =A0 =A0{.compatible =3D "ibm,opb",},
=A0 =A0 =A0 =A0{.compatible =3D "simple-bus",},
=A0 =A0 =A0 =A0{.compatible =3D "wrs,epld-localbus",},
+ =A0 =A0 =A0 {.compatible =3D "apm,apb",},
=A0 =A0 =A0 =A0{},
=A0};
@@ -163,11 +165,6 @@ static int __init add_legacy_soc_port(struct device_=
node *np,
=A0 =A0 =A0 =A0if (of_get_property(np, "clock-frequency", NULL) =3D=3D NU=
LL)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -1;

- =A0 =A0 =A0 /* if reg-shift or offset, don't try to use it */
- =A0 =A0 =A0 if ((of_get_property(np, "reg-shift", NULL) !=3D NULL) ||
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 (of_get_property(np, "reg-offset", NULL) !=
=3D NULL))
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
-
So we explicitly didn't support reg-shift before.  I'm guessing there is
a reason for that, but I don't recall what.  Ben?

Also, why do you need to use the legacy serial driver at all for this
SOC?  As far as I remember, the OF serial driver should be sufficient.
+static unsigned int reg_shift;
+#define ns16550_offset(addr) (addr - (unsigned char *)udbg_comport)
+
=A0static struct NS16550 __iomem *udbg_comport;

+static inline u8 serial_read(unsigned char *addr)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 return readb(udbg_comport + offset);
+}
+
+static inline void serial_write(unsigned char *addr, char val)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 writeb(val, udbg_comport + offset);
+}
+
I don't think readb/writeb are correct here.  Why did you switch to
using those instead of sticking with in_8/out_8?

josh

Re: [V2 2/5] powerpc: 40x: Add AHB, APB of_device_ids

From: Josh Boyer <hidden>
Date: 2012-05-02 13:41:39

On Mon, Apr 9, 2012 at 3:20 AM, Tanmay Inamdar [off-list ref] wrote:
Adding of_device_id's for AHB and APB buses used in klondike (APM8018X) in
platforms/40x/ppc40x_simple.c file

Signed-off-by: Tanmay Inamdar <redacted>
You should probably combine the first 3 patches in this series into one
patch.  Otherwise you run the risk of changing the DTS to something the
kernel can't support.  At the least, this change should be patch 1 in
the series, and you can probably combine the two DTS changes.

josh

Re: [V2 5/5] powerpc: kernel: 16650 UART reg-shift support

From: Tanmay Inamdar <hidden>
Date: 2012-05-09 05:27:53

On Wed, May 2, 2012 at 7:08 PM, Josh Boyer [off-list ref] wrote:
On Mon, Apr 9, 2012 at 3:20 AM, Tanmay Inamdar [off-list ref] wrote:
quoted
In APM8018X SOC, UART register address space has been relocated to 32-bi=
t
quoted
data boundaries for APB bus implementation.
Current legacy_serial driver ignores the reg-shift property. This patch
modifies legacy_serial.c and udbg_16550.c to work with above mentioned U=
ARTs.
quoted
Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 8338aef... f5fc106... M =A0arch/powerpc/include/asm/udbg.=
h
quoted
:100644 100644 bedd12e... d523b7d... M =A0arch/powerpc/kernel/legacy_ser=
ial.c
quoted
:100644 100644 6837f83... e0cb7dc... M =A0arch/powerpc/kernel/udbg_16550=
.c
quoted
=A0arch/powerpc/include/asm/udbg.h =A0 =A0 | =A0 =A02 +-
=A0arch/powerpc/kernel/legacy_serial.c | =A0 16 +++++---
=A0arch/powerpc/kernel/udbg_16550.c =A0 =A0| =A0 64 ++++++++++++++++++++=
++------------
quoted
=A03 files changed, 52 insertions(+), 30 deletions(-)
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/=
udbg.h
quoted
index 8338aef..f5fc106 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -29,7 +29,7 @@ extern void udbg_printf(const char *fmt, ...)
=A0extern void udbg_progress(char *s, unsigned short hex);

=A0extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock)=
;
quoted
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock,=
 =A0unsigned int regshift);
quoted
=A0extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0unsigned int clock);
quoted
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/l=
egacy_serial.c
quoted
index bedd12e..d523b7d 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -33,6 +33,7 @@ static struct legacy_serial_info {
=A0 =A0 =A0 =A0unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0clock=
;
quoted
=A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 irq_check_parent;
quoted
=A0 =A0 =A0 =A0phys_addr_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 taddr=
;
quoted
+ =A0 =A0 =A0 unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regshi=
ft;
quoted
=A0} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];

=A0static struct __initdata of_device_id legacy_serial_parents[] =3D {
@@ -42,6 +43,7 @@ static struct __initdata of_device_id legacy_serial_pa=
rents[] =3D {
quoted
=A0 =A0 =A0 =A0{.compatible =3D "ibm,opb",},
=A0 =A0 =A0 =A0{.compatible =3D "simple-bus",},
=A0 =A0 =A0 =A0{.compatible =3D "wrs,epld-localbus",},
+ =A0 =A0 =A0 {.compatible =3D "apm,apb",},
=A0 =A0 =A0 =A0{},
=A0};
@@ -163,11 +165,6 @@ static int __init add_legacy_soc_port(struct device=
_node *np,
quoted
=A0 =A0 =A0 =A0if (of_get_property(np, "clock-frequency", NULL) =3D=3D N=
ULL)
quoted
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -1;

- =A0 =A0 =A0 /* if reg-shift or offset, don't try to use it */
- =A0 =A0 =A0 if ((of_get_property(np, "reg-shift", NULL) !=3D NULL) ||
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 (of_get_property(np, "reg-offset", NULL) !=
=3D NULL))
quoted
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
-
So we explicitly didn't support reg-shift before. =A0I'm guessing there i=
s
a reason for that, but I don't recall what. =A0Ben?

Also, why do you need to use the legacy serial driver at all for this
SOC? =A0As far as I remember, the OF serial driver should be sufficient.
You are right. There is no need to use legacy serial driver. However I
realized that when 40x is selected, 'PPC_UDBG_16550' is by default
selected. This enables legacy serial driver.

Is it now required to enable 'PPC_UDBG_16550' by default for every SOC
that uses 40x processor?
quoted
+static unsigned int reg_shift;
+#define ns16550_offset(addr) (addr - (unsigned char *)udbg_comport)
+
=A0static struct NS16550 __iomem *udbg_comport;

+static inline u8 serial_read(unsigned char *addr)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 return readb(udbg_comport + offset);
+}
+
+static inline void serial_write(unsigned char *addr, char val)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 writeb(val, udbg_comport + offset);
+}
+
I don't think readb/writeb are correct here. =A0Why did you switch to
using those instead of sticking with in_8/out_8?

josh
Thanks,
Tanmay
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, =

is for the sole use of the intended recipient(s) and contains information=
=A0
that is confidential and proprietary to AppliedMicro Corporation or its s=
ubsidiaries. =

It is to be used solely for the purpose of furthering the parties' busine=
ss relationship. =

All unauthorized review, use, disclosure or distribution is prohibited. =

If you are not the intended recipient, please contact the sender by reply=
 e-mail =

and destroy all copies of the original message.
=0D

Re: [V2 2/5] powerpc: 40x: Add AHB, APB of_device_ids

From: Tanmay Inamdar <hidden>
Date: 2012-05-09 05:28:49

On Wed, May 2, 2012 at 7:11 PM, Josh Boyer [off-list ref] wrote:
On Mon, Apr 9, 2012 at 3:20 AM, Tanmay Inamdar [off-list ref] wrote:
quoted
Adding of_device_id's for AHB and APB buses used in klondike (APM8018X) =
in
quoted
platforms/40x/ppc40x_simple.c file

Signed-off-by: Tanmay Inamdar <redacted>
You should probably combine the first 3 patches in this series into one
patch. =A0Otherwise you run the risk of changing the DTS to something the
kernel can't support. =A0At the least, this change should be patch 1 in
the series, and you can probably combine the two DTS changes.
I will do it in next version of patches.
josh
Thanks,
Tanmay
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, =

is for the sole use of the intended recipient(s) and contains information=
=A0
that is confidential and proprietary to AppliedMicro Corporation or its s=
ubsidiaries. =

It is to be used solely for the purpose of furthering the parties' busine=
ss relationship. =

All unauthorized review, use, disclosure or distribution is prohibited. =

If you are not the intended recipient, please contact the sender by reply=
 e-mail =

and destroy all copies of the original message.
=0D

Re: [V2 5/5] powerpc: kernel: 16650 UART reg-shift support

From: Tanmay Inamdar <hidden>
Date: 2012-05-21 04:18:12

On Wed, May 9, 2012 at 10:57 AM, Tanmay Inamdar [off-list ref] wrote:
On Wed, May 2, 2012 at 7:08 PM, Josh Boyer [off-list ref] wrote:
quoted
On Mon, Apr 9, 2012 at 3:20 AM, Tanmay Inamdar [off-list ref] wrote:
quoted
In APM8018X SOC, UART register address space has been relocated to 32-b=
it
quoted
quoted
data boundaries for APB bus implementation.
Current legacy_serial driver ignores the reg-shift property. This patch
modifies legacy_serial.c and udbg_16550.c to work with above mentioned =
UARTs.
quoted
quoted
Signed-off-by: Tanmay Inamdar <redacted>
---
:100644 100644 8338aef... f5fc106... M =A0arch/powerpc/include/asm/udbg=
.h
quoted
quoted
:100644 100644 bedd12e... d523b7d... M =A0arch/powerpc/kernel/legacy_se=
rial.c
quoted
quoted
:100644 100644 6837f83... e0cb7dc... M =A0arch/powerpc/kernel/udbg_1655=
0.c
quoted
quoted
=A0arch/powerpc/include/asm/udbg.h =A0 =A0 | =A0 =A02 +-
=A0arch/powerpc/kernel/legacy_serial.c | =A0 16 +++++---
=A0arch/powerpc/kernel/udbg_16550.c =A0 =A0| =A0 64 +++++++++++++++++++=
+++------------
quoted
quoted
=A03 files changed, 52 insertions(+), 30 deletions(-)
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm=
/udbg.h
quoted
quoted
index 8338aef..f5fc106 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -29,7 +29,7 @@ extern void udbg_printf(const char *fmt, ...)
=A0extern void udbg_progress(char *s, unsigned short hex);

=A0extern void udbg_init_uart(void __iomem *comport, unsigned int speed=
,
quoted
quoted
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock=
);
quoted
quoted
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned int clock=
, =A0unsigned int regshift);
quoted
quoted
=A0extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0unsigned int clock);
quoted
quoted
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/=
legacy_serial.c
quoted
quoted
index bedd12e..d523b7d 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -33,6 +33,7 @@ static struct legacy_serial_info {
=A0 =A0 =A0 =A0unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cloc=
k;
quoted
quoted
=A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 irq_check_parent;
quoted
quoted
=A0 =A0 =A0 =A0phys_addr_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tadd=
r;
quoted
quoted
+ =A0 =A0 =A0 unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regsh=
ift;
quoted
quoted
=A0} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];

=A0static struct __initdata of_device_id legacy_serial_parents[] =3D {
@@ -42,6 +43,7 @@ static struct __initdata of_device_id legacy_serial_p=
arents[] =3D {
quoted
quoted
=A0 =A0 =A0 =A0{.compatible =3D "ibm,opb",},
=A0 =A0 =A0 =A0{.compatible =3D "simple-bus",},
=A0 =A0 =A0 =A0{.compatible =3D "wrs,epld-localbus",},
+ =A0 =A0 =A0 {.compatible =3D "apm,apb",},
=A0 =A0 =A0 =A0{},
=A0};
@@ -163,11 +165,6 @@ static int __init add_legacy_soc_port(struct devic=
e_node *np,
quoted
quoted
=A0 =A0 =A0 =A0if (of_get_property(np, "clock-frequency", NULL) =3D=3D =
NULL)
quoted
quoted
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -1;

- =A0 =A0 =A0 /* if reg-shift or offset, don't try to use it */
- =A0 =A0 =A0 if ((of_get_property(np, "reg-shift", NULL) !=3D NULL) ||
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 (of_get_property(np, "reg-offset", NULL) =
!=3D NULL))
quoted
quoted
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
-
So we explicitly didn't support reg-shift before. =A0I'm guessing there =
is
quoted
a reason for that, but I don't recall what. =A0Ben?

Also, why do you need to use the legacy serial driver at all for this
SOC? =A0As far as I remember, the OF serial driver should be sufficient.
You are right. There is no need to use legacy serial driver. However I
realized that when 40x is selected, 'PPC_UDBG_16550' is by default
selected. This enables legacy serial driver.

Is it now required to enable 'PPC_UDBG_16550' by default for every SOC
that uses 40x processor?
Josh, Ben,

Please let me know if you have any comments regarding above question.
quoted
quoted
+static unsigned int reg_shift;
+#define ns16550_offset(addr) (addr - (unsigned char *)udbg_comport)
+
=A0static struct NS16550 __iomem *udbg_comport;

+static inline u8 serial_read(unsigned char *addr)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 return readb(udbg_comport + offset);
+}
+
+static inline void serial_write(unsigned char *addr, char val)
+{
+ =A0 =A0 =A0 u32 offset =3D ns16550_offset(addr) << reg_shift;
+ =A0 =A0 =A0 writeb(val, udbg_comport + offset);
+}
+
I don't think readb/writeb are correct here. =A0Why did you switch to
using those instead of sticking with in_8/out_8?

josh
Thanks,
Tanmay
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, =

is for the sole use of the intended recipient(s) and contains information=
=A0
that is confidential and proprietary to AppliedMicro Corporation or its s=
ubsidiaries. =

It is to be used solely for the purpose of furthering the parties' busine=
ss relationship. =

All unauthorized review, use, disclosure or distribution is prohibited. =

If you are not the intended recipient, please contact the sender by reply=
 e-mail =

and destroy all copies of the original message.
=0D
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help