* [PATCH 12/19] powerpc: setup sio in SCC for Celleb
@ 2006-12-14 2:41 Ishizaki Kou
0 siblings, 0 replies; 3+ messages in thread
From: Ishizaki Kou @ 2006-12-14 2:41 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
This patch setup serial interfaces in SCC.
Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---
Index: linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c
diff -u /dev/null linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c:1.2
--- /dev/null Wed Dec 13 21:32:03 2006
+++ linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c Wed Dec 13 17:10:56 2006
@@ -0,0 +1,113 @@
+/*
+ * setup serial port in SCC
+ *
+ * (C) Copyright 2006 TOSHIBA CORPORATION
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/console.h>
+
+#include <asm/io.h>
+#include <asm/prom.h>
+
+/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024
+ mmio=0xfff000-0x1000,0xff2000-0x1000 */
+static int txx9_serial_bitmap = 0;
+
+static struct {
+ uint32_t offset;
+ uint32_t index;
+} txx9_spider_tab[3] = {
+ { 0x300, 0 }, /* 0xFFF300 */
+ { 0x400, 0 }, /* 0xFFF400 */
+ { 0x800, 1 } /* 0xFF2800 */
+};
+
+static int txx9_serial_init(void)
+{
+ extern int early_serial_txx9_setup(struct uart_port *port);
+ struct device_node *node;
+ const uint64_t *irq_prop, *base_prop;
+ int irq_len, base_addr_len;
+ int i, maxi;
+ struct uart_port req;
+
+ node = of_find_node_by_path("/ioif1/sio");
+ if (!node)
+ return 0;
+
+ irq_prop = get_property(node, "interrupts", &irq_len);
+ if (!irq_prop)
+ goto out;
+ irq_len /= sizeof(uint64_t);
+
+ base_prop = get_property(node, "toshiba,reg", &base_addr_len);
+ if (!base_prop)
+ goto out;
+ base_addr_len /= sizeof(uint64_t) * 2;
+
+ maxi = sizeof(txx9_spider_tab)/sizeof(txx9_spider_tab[0]);
+ if (maxi > irq_len)
+ maxi = irq_len;
+
+ for(i = 0; i < maxi; i++) {
+ if (!(txx9_serial_bitmap & (1<<i)))
+ continue;
+ if (base_addr_len <= txx9_spider_tab[i].index)
+ continue;
+
+ memset(&req, 0, sizeof(req));
+ req.line = i;
+ req.iotype = UPIO_MEM;
+ req.mapbase = base_prop[txx9_spider_tab[i].index * 2]
+ + txx9_spider_tab[i].offset;
+#ifdef CONFIG_SERIAL_TXX9_CONSOLE
+ req.membase = ioremap(req.mapbase, 0x24);
+#endif
+ req.irq = irq_create_mapping(NULL, irq_prop[i]);
+ req.flags |= UPF_IOREMAP | UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
+ req.uartclk = 83300000;
+ early_serial_txx9_setup(&req);
+ }
+
+out:
+ of_node_put(node);
+ return 0;
+}
+
+static int txx9_serial_config(char *ptr)
+{
+ int i;
+
+ for (;;) {
+ switch(get_option(&ptr, &i)) {
+ default:
+ return 0;
+ case 2:
+ txx9_serial_bitmap |= 1 << i;
+ break;
+ case 1:
+ txx9_serial_bitmap |= 1 << i;
+ return 0;
+ }
+ }
+}
+__setup("txx9_serial=", txx9_serial_config);
+
+console_initcall(txx9_serial_init);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 12/19] powerpc: setup sio in SCC for Celleb
@ 2007-01-12 1:12 Ishizaki Kou
2007-01-18 0:30 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Ishizaki Kou @ 2007-01-12 1:12 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
This patch setup serial interfaces in SCC to work with serial_txx9
driver.
Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---
Index: linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c
diff -u /dev/null linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c:1.5
--- /dev/null Thu Jan 11 22:03:27 2007
+++ linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c Wed Jan 10 17:48:12 2007
@@ -0,0 +1,101 @@
+/*
+ * setup serial port in SCC
+ *
+ * (C) Copyright 2006 TOSHIBA CORPORATION
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/console.h>
+
+#include <asm/io.h>
+#include <asm/prom.h>
+
+/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024
+ mmio=0xfff000-0x1000,0xff2000-0x1000 */
+static int txx9_serial_bitmap = 0;
+
+static struct {
+ uint32_t offset;
+ uint32_t index;
+} txx9_scc_tab[3] = {
+ { 0x300, 0 }, /* 0xFFF300 */
+ { 0x400, 0 }, /* 0xFFF400 */
+ { 0x800, 1 } /* 0xFF2800 */
+};
+
+static int txx9_serial_init(void)
+{
+ extern int early_serial_txx9_setup(struct uart_port *port);
+ struct device_node *node;
+ int i;
+ struct uart_port req;
+ struct of_irq irq;
+ struct resource res;
+
+ node = of_find_node_by_path("/ioif1/sio");
+ if (!node)
+ return 0;
+
+ for(i = 0; i < sizeof(txx9_scc_tab)/sizeof(txx9_scc_tab[0]); i++) {
+ if (!(txx9_serial_bitmap & (1<<i)))
+ continue;
+
+ if (of_irq_map_one(node, i, &irq))
+ continue;
+ if (of_address_to_resource(node, txx9_scc_tab[i].index, &res))
+ continue;
+
+ memset(&req, 0, sizeof(req));
+ req.line = i;
+ req.iotype = UPIO_MEM;
+ req.mapbase = res.start + txx9_scc_tab[i].offset;
+#ifdef CONFIG_SERIAL_TXX9_CONSOLE
+ req.membase = ioremap(req.mapbase, 0x24);
+#endif
+ req.irq = irq_create_of_mapping(irq.controller,
+ irq.specifier, irq.size);
+ req.flags |= UPF_IOREMAP | UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
+ req.uartclk = 83300000;
+ early_serial_txx9_setup(&req);
+ }
+
+ of_node_put(node);
+ return 0;
+}
+
+static int txx9_serial_config(char *ptr)
+{
+ int i;
+
+ for (;;) {
+ switch(get_option(&ptr, &i)) {
+ default:
+ return 0;
+ case 2:
+ txx9_serial_bitmap |= 1 << i;
+ break;
+ case 1:
+ txx9_serial_bitmap |= 1 << i;
+ return 0;
+ }
+ }
+}
+__setup("txx9_serial=", txx9_serial_config);
+
+console_initcall(txx9_serial_init);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 12/19] powerpc: setup sio in SCC for Celleb
2007-01-12 1:12 [PATCH 12/19] powerpc: setup sio in SCC for Celleb Ishizaki Kou
@ 2007-01-18 0:30 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-18 0:30 UTC (permalink / raw)
To: Ishizaki Kou; +Cc: linuxppc-dev, paulus
On Fri, 2007-01-12 at 10:12 +0900, Ishizaki Kou wrote:
> This patch setup serial interfaces in SCC to work with serial_txx9
> driver.
>
> Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> Index: linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c
> diff -u /dev/null linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c:1.5
> --- /dev/null Thu Jan 11 22:03:27 2007
> +++ linux-powerpc-git/arch/powerpc/platforms/celleb/scc_sio.c Wed Jan 10 17:48:12 2007
> @@ -0,0 +1,101 @@
> +/*
> + * setup serial port in SCC
> + *
> + * (C) Copyright 2006 TOSHIBA CORPORATION
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> +
> +#include <linux/tty.h>
> +#include <linux/serial.h>
> +#include <linux/serial_core.h>
> +#include <linux/console.h>
> +
> +#include <asm/io.h>
> +#include <asm/prom.h>
> +
> +/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024
> + mmio=0xfff000-0x1000,0xff2000-0x1000 */
> +static int txx9_serial_bitmap = 0;
> +
> +static struct {
> + uint32_t offset;
> + uint32_t index;
> +} txx9_scc_tab[3] = {
> + { 0x300, 0 }, /* 0xFFF300 */
> + { 0x400, 0 }, /* 0xFFF400 */
> + { 0x800, 1 } /* 0xFF2800 */
> +};
> +
> +static int txx9_serial_init(void)
> +{
> + extern int early_serial_txx9_setup(struct uart_port *port);
> + struct device_node *node;
> + int i;
> + struct uart_port req;
> + struct of_irq irq;
> + struct resource res;
> +
> + node = of_find_node_by_path("/ioif1/sio");
> + if (!node)
> + return 0;
> +
> + for(i = 0; i < sizeof(txx9_scc_tab)/sizeof(txx9_scc_tab[0]); i++) {
> + if (!(txx9_serial_bitmap & (1<<i)))
> + continue;
> +
> + if (of_irq_map_one(node, i, &irq))
> + continue;
> + if (of_address_to_resource(node, txx9_scc_tab[i].index, &res))
> + continue;
> +
> + memset(&req, 0, sizeof(req));
> + req.line = i;
> + req.iotype = UPIO_MEM;
> + req.mapbase = res.start + txx9_scc_tab[i].offset;
> +#ifdef CONFIG_SERIAL_TXX9_CONSOLE
> + req.membase = ioremap(req.mapbase, 0x24);
> +#endif
> + req.irq = irq_create_of_mapping(irq.controller,
> + irq.specifier, irq.size);
> + req.flags |= UPF_IOREMAP | UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
> + req.uartclk = 83300000;
> + early_serial_txx9_setup(&req);
> + }
> +
> + of_node_put(node);
> + return 0;
> +}
> +
> +static int txx9_serial_config(char *ptr)
> +{
> + int i;
> +
> + for (;;) {
> + switch(get_option(&ptr, &i)) {
> + default:
> + return 0;
> + case 2:
> + txx9_serial_bitmap |= 1 << i;
> + break;
> + case 1:
> + txx9_serial_bitmap |= 1 << i;
> + return 0;
> + }
> + }
> +}
> +__setup("txx9_serial=", txx9_serial_config);
> +
> +console_initcall(txx9_serial_init);
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-18 0:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-12 1:12 [PATCH 12/19] powerpc: setup sio in SCC for Celleb Ishizaki Kou
2007-01-18 0:30 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2006-12-14 2:41 Ishizaki Kou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).