MIPS: JZ4740: use Ingenic SoC UART driver
authorPaul Burton <paul.burton@imgtec.com>
Sun, 24 May 2015 15:11:45 +0000 (16:11 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 21 Jun 2015 19:53:26 +0000 (21:53 +0200)
Remove the serial support from arch/mips/jz4740 & make use of the new
Ingenic SoC UART driver. This is done for both regular & early console
output.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: linux-kernel@vger.kernel.org
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Apelete Seketeli <apelete@seketeli.net>
Cc: Alexandre Courbot <gnurou@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/10160/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/boot/dts/ingenic/jz4740.dtsi
arch/mips/boot/dts/ingenic/qi_lb60.dts
arch/mips/configs/qi_lb60_defconfig
arch/mips/include/asm/mach-jz4740/platform.h
arch/mips/jz4740/Makefile
arch/mips/jz4740/board-qi_lb60.c
arch/mips/jz4740/platform.c
arch/mips/jz4740/prom.c
arch/mips/jz4740/serial.c [deleted file]
arch/mips/jz4740/serial.h [deleted file]

index d5acb9e96d596e2dfff9da63ef9ec2b8515ea252..be384d6a58bbe75e5a6db93d4aaa28b7e2a1197e 100644 (file)
@@ -297,7 +297,6 @@ config MACH_INGENIC
        select DMA_NONCOHERENT
        select IRQ_MIPS_CPU
        select ARCH_REQUIRE_GPIOLIB
-       select SYS_HAS_EARLY_PRINTK
        select COMMON_CLK
        select GENERIC_IRQ_CHIP
        select BUILTIN_DTB
index be0a86f1563671dd63254a573181c60bbbab5ca6..8b2437cd019f3688feb0ed7bc0a290ec57d008a7 100644 (file)
 
                #clock-cells = <1>;
        };
+
+       uart0: serial@10030000 {
+               compatible = "ingenic,jz4740-uart";
+               reg = <0x10030000 0x100>;
+
+               interrupt-parent = <&intc>;
+               interrupts = <9>;
+
+               clocks = <&ext>, <&cgu JZ4740_CLK_UART0>;
+               clock-names = "baud", "module";
+       };
+
+       uart1: serial@10031000 {
+               compatible = "ingenic,jz4740-uart";
+               reg = <0x10031000 0x100>;
+
+               interrupt-parent = <&intc>;
+               interrupts = <8>;
+
+               clocks = <&ext>, <&cgu JZ4740_CLK_UART1>;
+               clock-names = "baud", "module";
+       };
 };
index 106d13cce11b942b4db76ee7c71f90e9065f0f9f..2414d63ae81898d35766c184862ad2bd6e27f41b 100644 (file)
@@ -4,6 +4,10 @@
 
 / {
        compatible = "qi,lb60", "ingenic,jz4740";
+
+       chosen {
+               stdout-path = &uart0;
+       };
 };
 
 &ext {
index 1139b899f96a5f1d857763918a45d824a94b4b16..d7bb8cce1068cc941c031be67c498a1286e0ed25 100644 (file)
@@ -66,6 +66,7 @@ CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_SERIAL_8250_DMA is not set
 CONFIG_SERIAL_8250_NR_UARTS=2
 CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+CONFIG_SERIAL_8250_INGENIC=y
 # CONFIG_HW_RANDOM is not set
 CONFIG_SPI=y
 CONFIG_SPI_GPIO=y
index 069b43a9da6f0e574f96a20054fcada425ad1e71..32cfbe6a191be8defd37fc373dc5a6cf951f3852 100644 (file)
@@ -35,6 +35,4 @@ extern struct platform_device jz4740_wdt_device;
 extern struct platform_device jz4740_pwm_device;
 extern struct platform_device jz4740_dma_device;
 
-void jz4740_serial_device_register(void);
-
 #endif
index 70a9578cc6db7bd9b78e6f118a7d4118aea68963..89ce40143854a86b2b10dbf8a98376d1772249ac 100644 (file)
@@ -5,7 +5,7 @@
 # Object file lists.
 
 obj-y += prom.o time.o reset.o setup.o \
-       gpio.o platform.o timer.o serial.o
+       gpio.o platform.o timer.o
 
 CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt
 
index 21b034cea864203926f78a47870e04caa2dbe6fa..4e62bf85d0b0f910cc56c726167cb933b35045d0 100644 (file)
@@ -482,8 +482,6 @@ static int __init qi_lb60_init_platform_devices(void)
        gpiod_add_lookup_table(&qi_lb60_audio_gpio_table);
        gpiod_add_lookup_table(&qi_lb60_nand_gpio_table);
 
-       jz4740_serial_device_register();
-
        spi_register_board_info(qi_lb60_spi_board_info,
                                ARRAY_SIZE(qi_lb60_spi_board_info));
 
index 2a5c7c7d0735e1b131c28d3a89efdfee05cea8c3..e8a463b9b663edec81ebe547aebbe8b7645a6adf 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
 
-#include "serial.h"
 #include "clock.h"
 
 /* OHCI controller */
@@ -280,50 +279,6 @@ struct platform_device jz4740_adc_device = {
        .resource       = jz4740_adc_resources,
 };
 
-/* Serial */
-#define JZ4740_UART_DATA(_id) \
-       { \
-               .flags = UPF_SKIP_TEST | UPF_IOREMAP | UPF_FIXED_TYPE, \
-               .iotype = UPIO_MEM, \
-               .regshift = 2, \
-               .serial_out = jz4740_serial_out, \
-               .type = PORT_16550, \
-               .mapbase = JZ4740_UART ## _id ## _BASE_ADDR, \
-               .irq = JZ4740_IRQ_UART ## _id, \
-       }
-
-static struct plat_serial8250_port jz4740_uart_data[] = {
-       JZ4740_UART_DATA(0),
-       JZ4740_UART_DATA(1),
-       {},
-};
-
-static struct platform_device jz4740_uart_device = {
-       .name = "serial8250",
-       .id = 0,
-       .dev = {
-               .platform_data = jz4740_uart_data,
-       },
-};
-
-void jz4740_serial_device_register(void)
-{
-       struct plat_serial8250_port *p;
-       struct clk *ext_clk;
-       unsigned long ext_rate;
-
-       ext_clk = clk_get(NULL, "ext");
-       if (IS_ERR(ext_clk))
-               panic("unable to get ext clock");
-       ext_rate = clk_get_rate(ext_clk);
-       clk_put(ext_clk);
-
-       for (p = jz4740_uart_data; p->flags != 0; ++p)
-               p->uartclk = ext_rate;
-
-       platform_device_register(&jz4740_uart_device);
-}
-
 /* Watchdog */
 static struct resource jz4740_wdt_resources[] = {
        {
index 5a93f381590dbb04cb45bb105536d0c072659523..6984683c90d03250735070172aaab7dde8c15247 100644 (file)
@@ -53,16 +53,3 @@ void __init prom_init(void)
 void __init prom_free_prom_memory(void)
 {
 }
-
-#define UART_REG(_reg) ((void __iomem *)CKSEG1ADDR(JZ4740_UART0_BASE_ADDR + (_reg << 2)))
-
-void prom_putchar(char c)
-{
-       uint8_t lsr;
-
-       do {
-               lsr = readb(UART_REG(UART_LSR));
-       } while ((lsr & UART_LSR_TEMT) == 0);
-
-       writeb(c, UART_REG(UART_TX));
-}
diff --git a/arch/mips/jz4740/serial.c b/arch/mips/jz4740/serial.c
deleted file mode 100644 (file)
index d23de45..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
- *  JZ4740 serial support
- *
- *  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.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/io.h>
-#include <linux/serial_core.h>
-#include <linux/serial_reg.h>
-
-void jz4740_serial_out(struct uart_port *p, int offset, int value)
-{
-       switch (offset) {
-       case UART_FCR:
-               value |= 0x10; /* Enable uart module */
-               break;
-       case UART_IER:
-               value |= (value & 0x4) << 2;
-               break;
-       default:
-               break;
-       }
-       writeb(value, p->membase + (offset << p->regshift));
-}
diff --git a/arch/mips/jz4740/serial.h b/arch/mips/jz4740/serial.h
deleted file mode 100644 (file)
index 8eb715b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
- *  JZ4740 serial support
- *
- *  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.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef __MIPS_JZ4740_SERIAL_H__
-#define __MIPS_JZ4740_SERIAL_H__
-
-struct uart_port;
-
-void jz4740_serial_out(struct uart_port *p, int offset, int value);
-
-#endif