All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] Add MIPS arch support to barebox
Date: Tue, 28 Jun 2011 09:21:47 +0200	[thread overview]
Message-ID: <20110628072147.GG6069@pengutronix.de> (raw)
In-Reply-To: <1309194834-2292-2-git-send-email-antonynpavlov@gmail.com>

On Mon, Jun 27, 2011 at 09:13:54PM +0400, Antony Pavlov wrote:
> Only supported board is qemu malta:
>   * barebox works in uncached memory;
>   * no peripherals support, but serial port.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>

Looks mostly good, some comments inline.

> ---
>  arch/architecture.dox                       |    1 +
>  arch/mips/Kconfig                           |   55 ++
>  arch/mips/Makefile                          |   51 ++
>  arch/mips/boards/malta/Makefile             |    1 +
>  arch/mips/boards/malta/config.h             |   19 +
>  arch/mips/boards/malta/serial.c             |   64 ++
>  arch/mips/boot/Makefile                     |    4 +
>  arch/mips/boot/entry.c                      |   80 +++
>  arch/mips/boot/head.S                       |  233 +++++++
>  arch/mips/configs/malta_defconfig           |  219 ++++++
>  arch/mips/include/asm/barebox.h             |   24 +
>  arch/mips/include/asm/bitops.h              |   32 +
>  arch/mips/include/asm/byteorder.h           |   30 +
>  arch/mips/include/asm/common.h              |   29 +
>  arch/mips/include/asm/elf.h                 |   30 +
>  arch/mips/include/asm/io.h                  |   73 ++
>  arch/mips/include/asm/mipsregs.h            |  988 +++++++++++++++++++++++++++
>  arch/mips/include/asm/module.h              |   36 +
>  arch/mips/include/asm/posix_types.h         |   48 ++
>  arch/mips/include/asm/regdef.h              |  100 +++
>  arch/mips/include/asm/sections.h            |    1 +
>  arch/mips/include/asm/sgidefs.h             |   44 ++
>  arch/mips/include/asm/string.h              |   31 +
>  arch/mips/include/asm/swab.h                |   59 ++
>  arch/mips/include/asm/types.h               |   44 ++
>  arch/mips/include/mach/debug_ll.h           |   35 +
>  arch/mips/lib/.gitignore                    |    1 +
>  arch/mips/lib/Makefile                      |    5 +
>  arch/mips/lib/ashldi3.c                     |   27 +
>  arch/mips/lib/ashrdi3.c                     |   29 +
>  arch/mips/lib/barebox.lds.S                 |   76 ++
>  arch/mips/lib/libgcc.h                      |   25 +
>  arch/mips/lib/lshrdi3.c                     |   27 +
>  arch/mips/lib/memory.c                      |   34 +
>  arch/mips/mach-mips.dox                     |    9 +
>  arch/mips/mach-qemu/Kconfig                 |   12 +
>  arch/mips/mach-qemu/Makefile                |    4 +
>  arch/mips/mach-qemu/csrc-r4k.c              |   50 ++
>  arch/mips/mach-qemu/include/mach/hardware.h |   28 +
>  arch/mips/mach-qemu/reset.c                 |   34 +
>  40 files changed, 2692 insertions(+), 0 deletions(-)
>  create mode 100644 arch/mips/Kconfig
>  create mode 100644 arch/mips/Makefile
>  create mode 100644 arch/mips/boards/malta/Makefile
>  create mode 100644 arch/mips/boards/malta/config.h
>  create mode 100644 arch/mips/boards/malta/serial.c
>  create mode 100644 arch/mips/boot/Kconfig
>  create mode 100644 arch/mips/boot/Makefile
>  create mode 100644 arch/mips/boot/entry.c
>  create mode 100644 arch/mips/boot/head.S
>  create mode 100644 arch/mips/configs/malta_defconfig
>  create mode 100644 arch/mips/include/asm/barebox.h
>  create mode 100644 arch/mips/include/asm/bitops.h
>  create mode 100644 arch/mips/include/asm/byteorder.h
>  create mode 100644 arch/mips/include/asm/common.h
>  create mode 100644 arch/mips/include/asm/elf.h
>  create mode 100644 arch/mips/include/asm/io.h
>  create mode 100644 arch/mips/include/asm/mipsregs.h
>  create mode 100644 arch/mips/include/asm/module.h
>  create mode 100644 arch/mips/include/asm/posix_types.h
>  create mode 100644 arch/mips/include/asm/regdef.h
>  create mode 100644 arch/mips/include/asm/sections.h
>  create mode 100644 arch/mips/include/asm/sgidefs.h
>  create mode 100644 arch/mips/include/asm/string.h
>  create mode 100644 arch/mips/include/asm/swab.h
>  create mode 100644 arch/mips/include/asm/types.h
>  create mode 100644 arch/mips/include/mach/debug_ll.h
>  create mode 100644 arch/mips/lib/.gitignore
>  create mode 100644 arch/mips/lib/Makefile
>  create mode 100644 arch/mips/lib/ashldi3.c
>  create mode 100644 arch/mips/lib/ashrdi3.c
>  create mode 100644 arch/mips/lib/barebox.lds.S
>  create mode 100644 arch/mips/lib/libgcc.h
>  create mode 100644 arch/mips/lib/lshrdi3.c
>  create mode 100644 arch/mips/lib/memory.c
>  create mode 100644 arch/mips/mach-mips.dox
>  create mode 100644 arch/mips/mach-qemu/Kconfig
>  create mode 100644 arch/mips/mach-qemu/Makefile
>  create mode 100644 arch/mips/mach-qemu/csrc-r4k.c
>  create mode 100644 arch/mips/mach-qemu/include/mach/hardware.h
>  create mode 100644 arch/mips/mach-qemu/reset.c
> 
> diff --git a/arch/mips/boards/malta/serial.c b/arch/mips/boards/malta/serial.c
> new file mode 100644
> index 0000000..b3ade0c
> --- /dev/null
> +++ b/arch/mips/boards/malta/serial.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (C) 2011 Antony Pavlov <antonynpavlov@gmail.com>
> + *
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + */
> +
> +#include <common.h>
> +#include <types.h>
> +#include <driver.h>
> +#include <init.h>
> +#include <ns16550.h>
> +#include <mach/hardware.h>
> +#include <asm/io.h>
> +
> +#ifdef CONFIG_DRIVER_SERIAL_NS16550
> +/** to work with the 8250 UART driver implementation we need this function */
> +unsigned int malta_uart_read(unsigned long base, unsigned char reg_idx)
> +{
> +	return readb(base + reg_idx);
> +}
> +
> +/** to work with the 8250 UART driver implementation we need this function */
> +void malta_uart_write(unsigned int val, unsigned long base, unsigned char reg_idx)
> +{
> +	writeb(val, base + reg_idx);
> +}
> +
> +static struct NS16550_plat serial_plat = {
> +       .clock = 1843200, /* no matter */
> +       .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
> +       .reg_read = malta_uart_read,
> +       .reg_write = malta_uart_write,
> +};
> +
> +/* we are expecting always one serial interface */
> +static struct device_d generic_malta_serial_device = {
> +       .name = "serial_ns16550",
> +       .map_base = DEBUG_LL_UART_ADDR,
> +       .size = 8,
> +       .platform_data = (void *)&serial_plat,
> +};
> +
> +static int malta_console_init(void)
> +{
> +       /* Register the serial port */
> +       return register_device(&generic_malta_serial_device);
> +}
> +console_initcall(malta_console_init);
> +
> +#endif

The whole file is inside CONFIG_DRIVER_SERIAL_NS16550, so you can do
a obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o in the Makefile
instead.

> diff --git a/arch/mips/boot/Kconfig b/arch/mips/boot/Kconfig
> new file mode 100644
> index 0000000..e69de29
> diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
> new file mode 100644
> index 0000000..fd7a745
> --- /dev/null
> +++ b/arch/mips/boot/Makefile
> @@ -0,0 +1,4 @@
> +CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -g -O0 -march=mips64
> +
> +obj-y += head.o
> +obj-y += entry.o

> diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig

Please generate your defconfig file with make savedefconfig

> diff --git a/arch/mips/include/asm/posix_types.h b/arch/mips/include/asm/posix_types.h
> new file mode 100644
> index 0000000..a7d0c25
> --- /dev/null
> +++ b/arch/mips/include/asm/posix_types.h
> @@ -0,0 +1,48 @@
> +/*
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + */
> +
> +/**
> + * @file
> + * @brief mips posix types
> + *
> + * Minimal set to make all the other header files copied from the Linxu kernel happy

s/Linxu/Linux/

> + */
> +
> +#ifndef _ASM_MIPS_POSIX_TYPES_H
> +#define _ASM_MIPS_POSIX_TYPES_H
> +
> +typedef unsigned long	__kernel_ino_t;
> +typedef unsigned short	__kernel_mode_t;
> +typedef unsigned short	__kernel_nlink_t;
> +typedef long		__kernel_off_t;
> +typedef int		__kernel_pid_t;
> +typedef unsigned int	__kernel_size_t;
> +typedef int		__kernel_ssize_t;
> +typedef int		__kernel_ptrdiff_t;
> +typedef long		__kernel_time_t;
> +typedef long		__kernel_suseconds_t;
> +typedef long		__kernel_clock_t;
> +typedef int		__kernel_daddr_t;
> +typedef char *		__kernel_caddr_t;
> +typedef unsigned short	__kernel_uid16_t;
> +typedef unsigned short	__kernel_gid16_t;
> +typedef unsigned int	__kernel_uid32_t;
> +typedef unsigned int	__kernel_gid32_t;
> +typedef long long	__kernel_loff_t;
> +
> +#endif /* _ASM_MIPS_POSIX_TYPES_H */
> diff --git a/arch/mips/mach-qemu/csrc-r4k.c b/arch/mips/mach-qemu/csrc-r4k.c
> new file mode 100644
> index 0000000..bb54700
> --- /dev/null
> diff --git a/arch/mips/mach-qemu/reset.c b/arch/mips/mach-qemu/reset.c
> new file mode 100644
> index 0000000..c5a2537
> --- /dev/null
> +++ b/arch/mips/mach-qemu/reset.c
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright (C) 2009 Juergen Beisert, Pengutronix
> + *
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + */
> +
> +/**
> + * @file
> + * @brief Resetting an CPU
> + */
> +
> +#include <common.h>
> +
> +void reset_cpu(ulong addr)
> +{
> +	/** How to reset the machine? */

I don't know either. We should add some printf here until we know.

> +	while(1)
> +		;
> +}
> +EXPORT_SYMBOL(reset_cpu);
> -- 
> 1.7.5.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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

  parent reply	other threads:[~2011-06-28  7:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 17:13 [PATCH 1/2] include/linux/stat.h: make struct stat unified Antony Pavlov
2011-06-27 17:13 ` [PATCH 2/2] Add MIPS arch support to barebox Antony Pavlov
2011-06-28  5:11   ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-28  6:14     ` Antony Pavlov
2011-06-28  9:37     ` Antony Pavlov
2011-06-28 10:06       ` Sascha Hauer
2011-06-28 13:29       ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-28 16:23         ` Shinya Kuribayashi
2011-06-28  7:21   ` Sascha Hauer [this message]
2011-06-28  9:03     ` Antony Pavlov
2011-06-28 15:06   ` Shinya Kuribayashi
2011-06-28 15:42     ` Antony Pavlov
2011-06-28  6:40 ` [PATCH 1/2] include/linux/stat.h: make struct stat unified Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110628072147.GG6069@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.