MIPS: JZ4750D: Add base support for Ingenic JZ4750D SOC
RFC 2/13 MIPS: JZ4750D: Add clock API support
In reply to Antony PavlovAdd support for managing the clocks found on JZ4750D SoC through the Linux clock API.
--- arch/mips/jz4750d/clock-debugfs.c | 107 ++++++++ arch/mips/jz4750d/clock.c | 499 +++++++++++++++++++++++++++++++++++++ arch/mips/jz4750d/clock.h | 75 ++++++ 3 files changed, 681 insertions(+) create mode 100644 arch/mips/jz4750d/clock-debugfs.c create mode 100644 arch/mips/jz4750d/clock.c create mode 100644 arch/mips/jz4750d/clock.h
arch/mips/jz4750d/clock-debugfs.c new file +107 -0
@@ -0,0 +1,107 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D SoC clock support debugfs entries +* +* based on JZ4740 SoC clock support debugfs entries +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/clk.h> +#include <linux/err.h> + +#include <linux/debugfs.h> +#include <linux/uaccess.h> + +#include "clock.h" + +static struct dentry *jz4750d_clock_debugfs; + +static int jz4750d_clock_debugfs_show_enabled (void *data,uint64_t *value) +{ +struct clk *clk = data; + *value =clk_is_enabled (clk); + +return 0 ; +} + +static int jz4750d_clock_debugfs_set_enabled (void *data,uint64_t value) +{ +struct clk *clk = data; + +if (value) +return clk_enable (clk); +else +clk_disable (clk); + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (jz4750d_clock_debugfs_ops_enabled, + jz4750d_clock_debugfs_show_enabled, + jz4750d_clock_debugfs_set_enabled, +"%llu\n" ); + +static int jz4750d_clock_debugfs_show_rate (void *data,uint64_t *value) +{ +struct clk *clk = data; + *value =clk_get_rate (clk); + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (jz4750d_clock_debugfs_ops_rate, + jz4750d_clock_debugfs_show_rate, +NULL , +"%llu\n" ); + +void jz4750d_clock_debugfs_add_clk (struct clk *clk) +{ +if (!jz4750d_clock_debugfs) +return ; + + clk->debugfs_entry =debugfs_create_dir (clk->name, jz4750d_clock_debugfs); +debugfs_create_file ("rate" ,S_IWUGO |S_IRUGO , clk->debugfs_entry, clk, + &jz4750d_clock_debugfs_ops_rate); +debugfs_create_file ("enabled" ,S_IRUGO , clk->debugfs_entry, clk, + &jz4750d_clock_debugfs_ops_enabled); + +if (clk->parent) { +char parent_path[100 ]; +snprintf (parent_path,100 ,"../%s" , clk->parent->name); + clk->debugfs_parent_entry =debugfs_create_symlink ("parent" , + clk->debugfs_entry, + parent_path); + } +} + +/* TODO: Locking */ +void jz4750d_clock_debugfs_update_parent (struct clk *clk) +{ +if (clk->debugfs_parent_entry) +debugfs_remove (clk->debugfs_parent_entry); + +if (clk->parent) { +char parent_path[100 ]; +snprintf (parent_path,100 ,"../%s" , clk->parent->name); + clk->debugfs_parent_entry =debugfs_create_symlink ("parent" , + clk->debugfs_entry, + parent_path); + }else { + clk->debugfs_parent_entry =NULL ; + } +} + +void jz4750d_clock_debugfs_init (void ) +{ + jz4750d_clock_debugfs =debugfs_create_dir ("jz4750d-clock" ,NULL ); +if (IS_ERR (jz4750d_clock_debugfs)) + jz4750d_clock_debugfs =NULL ; +}
arch/mips/jz4750d/clock.c new file +499 -0
499 lines not on this page · raw message
arch/mips/jz4750d/clock.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
1.7.10.4
cover MIPS: JZ4750D: Add base support for Ingenic JZ4750D SOC
AFAIK the single known chip in Ingenic JZ4750D line is JZ4755. It has just the same CPU core as JZ4740, but another set of peripherals (though the program model for the most of the peripherals is the same).
+-----------------+--------------+--------------+ | | JZ4755 | JZ4740 | +-----------------+--------------+--------------+ | UART | 3 | 4 | | MSC (mmc/sd) | 2 | 1 | | GPIO | 5x32 | 4x32 | | TCU (timers) | 6x16 + 1x32 | 8x16 | | USB | device 2.0 | host 1.1 | | | | device 2.0 | +-----------------+--------------+--------------+
The most significant advantage of the JZ4755 chip is the second MIPS core dedicated for image processing. Also JZ4755 is made with use of more precise technology and it can run on the higher clock rate (approx. 433 MHz for JZ4755 vs 336 MHz for JZ4740).
The JZ4755 is used in some game consoles:
* Ritmix RZX-50;
* Dingoo A320E/A380;
* GameLinBox.
This patch series based on the work of Lars-Peter Clausen. To tell the truth it is the Lars-Peter Clausen's patches with some fixes and changes.
As most of the code for JZ4750D is very close to code for JZ4740 we can incorporate the code for JZ4750D to the code for JZ4740 to avoid code duplication.
I propose to rename 'jz4740' mach directory to 'xburst' or 'ingenic'.
The patch series introduces the minimal support for the JZ4755, no peripherals are enabled save UART1. To test the kernel I run it with incorporated initrd rootfs made with help of https://github.com/gcwnow/buildroot.git
[RFC 01/13] MIPS: JZ4750D: Add base support for Ingenic JZ4750D [RFC 02/13] MIPS: JZ4750D: Add clock API support
[RFC 03/13] MIPS: JZ4750D: Add IRQ handler code
[RFC 04/13] MIPS: JZ4750D: Add timer support
[RFC 05/13] MIPS: JZ4750D: Add clocksource/clockevent support [RFC 06/13] MIPS: JZ4750D: Add system reset support [RFC 07/13] MIPS: JZ4750D: Add setup code
[RFC 08/13] MIPS: JZ4750D: Add serial support
[RFC 09/13] MIPS: JZ4750D: Add prom support
[RFC 10/13] MIPS: JZ4750D: Add platform UART devices [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
[RFC 12/13] MIPS: JZ4750D: Add rzx50 board support [RFC 13/13] MIPS: rzx50: Add defconfig file
RFC 1/13 MIPS: JZ4750D: Add base support for Ingenic JZ4750D System-on-a-Chip
Adds a new cpu type for the JZ4750D to the Linux MIPS architecture code. It also adds the iomem addresses for the different components found on a JZ4750D SoC.
--- arch/mips/include/asm/bootinfo.h | 1 + arch/mips/include/asm/mach-jz4750d/base.h | 12 ++++++++++++ arch/mips/include/asm/mach-jz4750d/war.h | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 arch/mips/include/asm/mach-jz4750d/base.h create mode 100644 arch/mips/include/asm/mach-jz4750d/war.h
arch/mips/include/asm/bootinfo.h +1 -0
@@ -76,6 +76,7 @@*/ #define MACH_INGENIC_JZ4730 0/* JZ4730 SOC */ #define MACH_INGENIC_JZ4740 1/* JZ4740 SOC */ +#define MACH_INGENIC_JZ4750D 3/* JZ4750D SOC */ extern char *system_type;const char *get_system_type (void );
arch/mips/include/asm/mach-jz4750d/base.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_MACH_JZ4750D_BASE_H__ +#define __ASM_MACH_JZ4750D_BASE_H__ + +#define JZ4750D_CPM_BASE_ADDR 0x10000000 +#define JZ4750D_INTC_BASE_ADDR 0x10001000 +#define JZ4750D_WDT_BASE_ADDR 0x10002000 +#define JZ4750D_TCU_BASE_ADDR 0x10002010 +#define JZ4750D_RTC_BASE_ADDR 0x10003000 +#define JZ4750D_UART0_BASE_ADDR 0x10030000 +#define JZ4750D_UART1_BASE_ADDR 0x10031000 + +#endif
arch/mips/include/asm/mach-jz4750d/war.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <[email protected]> +*/ +#ifndef __ASM_MIPS_MACH_JZ4750D_WAR_H +#define __ASM_MIPS_MACH_JZ4750D_WAR_H + +#define R4600_V1_INDEX_ICACHEOP_WAR 0 +#define R4600_V1_HIT_CACHEOP_WAR 0 +#define R4600_V2_HIT_CACHEOP_WAR 0 +#define R5432_CP0_INTERRUPT_WAR 0 +#define BCM1250_M3_WAR 0 +#define SIBYTE_1956_WAR 0 +#define MIPS4K_ICACHE_REFILL_WAR 0 +#define MIPS_CACHE_SYNC_WAR 0 +#define TX49XX_ICACHE_INDEX_INV_WAR 0 +#define RM9000_CDEX_SMP_WAR 0 +#define ICACHE_REFILLS_WORKAROUND_WAR 0 +#define R10000_LLSC_WAR 0 +#define MIPS34K_MISSED_ITLB_WAR 0 + +#endif /* __ASM_MIPS_MACH_JZ4750D_WAR_H */
Signature · 1 line
1.7.10.4
RFC 3/13 MIPS: JZ4750D: Add IRQ handler code
In reply to Antony PavlovAdd support for IRQ handling on a JZ4750D SoC.
--- arch/mips/include/asm/mach-jz4750d/irq.h | 29 ++++++ arch/mips/jz4750d/irq.c | 158 ++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 arch/mips/include/asm/mach-jz4750d/irq.h create mode 100644 arch/mips/jz4750d/irq.c
arch/mips/include/asm/mach-jz4750d/irq.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D IRQ definitions +* +* based on JZ4740 IRQ definitions +* Copyright (C) 2009-2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#ifndef __ASM_MACH_JZ4750D_IRQ_H__ +#define __ASM_MACH_JZ4750D_IRQ_H__ + +#define MIPS_CPU_IRQ_BASE 0 +#define JZ4750D_IRQ_BASE 8 + +#define JZ4750D_IRQ (x) (JZ4750D_IRQ_BASE + (x)) + +#define JZ4750D_IRQ_UART1 JZ4750D_IRQ(8) +#define JZ4750D_IRQ_UART0 JZ4750D_IRQ(9) +#define JZ4750D_IRQ_TCU1 JZ4750D_IRQ(22) + +#define NR_IRQS (256) + +#endif
arch/mips/jz4750d/irq.c new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 6/13 MIPS: JZ4750D: Add system reset support
In reply to Antony PavlovAdd support for poweroff/reboot on a JZ4750D SoC.
--- arch/mips/jz4750d/reset.c | 79 +++++++++++++++++++++++++++++++++++++++++++++ arch/mips/jz4750d/reset.h | 6 ++++ 2 files changed, 85 insertions(+) create mode 100644 arch/mips/jz4750d/reset.c create mode 100644 arch/mips/jz4750d/reset.h
arch/mips/jz4750d/reset.c new file +79 -0
@@ -0,0 +1,79 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D reset routines +* +* based on JZ4740 reset routines +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/pm.h> + +#include <asm/reboot.h> + +#include <asm/mach-jz4750d/base.h> +#include <asm/mach-jz4750d/timer.h> + +static void jz4750d_halt (void ) +{ +while (1 ) { + __asm__(".set push;\n" +".set mips3;\n" +"wait;\n" +".set pop;\n" + ); + } +} + +#define JZ_REG_WDT_DATA 0x00 +#define JZ_REG_WDT_COUNTER_ENABLE 0x04 +#define JZ_REG_WDT_COUNTER 0x08 +#define JZ_REG_WDT_CTRL 0x0c + +static void jz4750d_restart (char *command) +{ +void __iomem *wdt_base =ioremap (JZ4750D_WDT_BASE_ADDR ,0x0f ); + +jz4750d_timer_enable_watchdog (); + +writeb (0 , wdt_base +JZ_REG_WDT_COUNTER_ENABLE ); + +writew (0 , wdt_base +JZ_REG_WDT_COUNTER ); +writew (0 , wdt_base +JZ_REG_WDT_DATA ); +writew (BIT (2 ), wdt_base +JZ_REG_WDT_CTRL ); + +writeb (1 , wdt_base +JZ_REG_WDT_COUNTER_ENABLE ); +jz4750d_halt (); +} + +#define JZ_REG_RTC_CTRL 0x00 +#define JZ_REG_RTC_HIBERNATE 0x20 + +#define JZ_RTC_CTRL_WRDY BIT(7) + +static void jz4750d_power_off (void ) +{ +void __iomem *rtc_base =ioremap (JZ4750D_RTC_BASE_ADDR ,0x24 ); +uint32_t ctrl; + +do { + ctrl =readl (rtc_base +JZ_REG_RTC_CTRL ); + }while (!(ctrl &JZ_RTC_CTRL_WRDY )); + +writel (1 , rtc_base +JZ_REG_RTC_HIBERNATE ); +jz4750d_halt (); +} + +void jz4750d_reset_init (void ) +{ + _machine_restart = jz4750d_restart; + _machine_halt = jz4750d_halt; + pm_power_off = jz4750d_power_off; +}
arch/mips/jz4750d/reset.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __MIPS_JZ4750D_RESET_H__ +#define __MIPS_JZ4750D_RESET_H__ + +extern void jz4750d_reset_init (void ); + +#endif
Signature · 1 line
1.7.10.4
RFC 7/13 MIPS: JZ4750D: Add setup code
In reply to Antony PavlovAdd get_system_type for JZ4750D SoCs. Fix memory size to 64M.
--- arch/mips/jz4750d/setup.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 arch/mips/jz4750d/setup.c
arch/mips/jz4750d/setup.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D setup code +* +* based on JZ4740 setup code +* Copyright (C) 2009-2010, Lars-Peter Clausen <[email protected]> +* Copyright (C) 2011, Maarten ter Huurne <[email protected]> +* +* 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. +* +*/ + +#include <linux/init.h> +#include <linux/io.h> +#include <linux/kernel.h> + +#include <asm/bootinfo.h> + +#include "reset.h" + +void __init plat_mem_setup (void ) +{ +jz4750d_reset_init (); + +/* FIXME: the detection of the memory size is skipped */ +add_memory_region (0 ,0x04000000 /* 64 M */ ,BOOT_MEM_RAM ); +} + +const char *get_system_type (void ) +{ +return "JZ4750D" ; +}
Signature · 1 line
1.7.10.4
RFC 8/13 MIPS: JZ4750D: Add serial support
In reply to Antony PavlovThe JZ4750D UART interface is almost 16550 compatible.
The UART module needs to be enabled by setting a bit in the FCR register and it has support for receive timeout interrupts. Instead of adding yet another machine specific quirk to the 8250 serial driver we provide a serial_out implementation which sets the required additional flags.
--- arch/mips/jz4750d/serial.c | 32 ++++++++++++++++++++++++++++++++ arch/mips/jz4750d/serial.h | 22 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 arch/mips/jz4750d/serial.c create mode 100644 arch/mips/jz4750d/serial.h
arch/mips/jz4750d/serial.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D serial support +* +* based on JZ4740 serial support +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#include <linux/io.h> +#include <linux/serial_core.h> +#include <linux/serial_reg.h> + +void jz4750d_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)); +}
arch/mips/jz4750d/serial.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D serial support +* +* based on JZ4740 serial support +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#ifndef __MIPS_JZ4750D_SERIAL_H__ +#define __MIPS_JZ4750D_SERIAL_H__ + +struct uart_port ; + +void jz4750d_serial_out (struct uart_port *p,int offset,int value); + +#endif
Signature · 1 line
1.7.10.4
RFC 5/13 MIPS: JZ4750D: Add clocksource/clockevent support
In reply to Antony PavlovAdd clocksource and clockevent support for the timer/counter unit on JZ4750D SoCs.
--- arch/mips/jz4750d/time.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 arch/mips/jz4750d/time.c
arch/mips/jz4750d/time.c new file +145 -0
@@ -0,0 +1,145 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D platform time support +* +* based on JZ4740 platform time support +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/time.h> + +#include <linux/clockchips.h> + +#include <asm/time.h> + +#include "clock.h" +#include "timer.h" + +#define TIMER_CLOCKEVENT 5 + +static uint16_t jz4750d_jiffies_per_tick; + +static cycle_t jz4750d_clocksource_read (struct clocksource *cs) +{ +return (cycle_t )jz4750d_ostimer_get_count (); +} + +static struct clocksource jz4750d_clocksource = { + .name ="jz4750d-timer" , + .rating =200 , + .read = jz4750d_clocksource_read, + .mask =CLOCKSOURCE_MASK (32 ), + .flags =CLOCK_SOURCE_WATCHDOG , +}; + +static irqreturn_t jz4750d_clockevent_irq (int irq,void *devid) +{ +struct clock_event_device *cd = devid; + +jz4750d_timer_ack_full (TIMER_CLOCKEVENT ); + +if (cd->mode !=CLOCK_EVT_MODE_PERIODIC ) +jz4750d_timer_disable (TIMER_CLOCKEVENT ); + + cd->event_handler (cd); + +return IRQ_HANDLED ; +} + +static void jz4750d_clockevent_set_mode (enum clock_event_mode mode, +struct clock_event_device *cd) +{ +switch (mode) { +case CLOCK_EVT_MODE_PERIODIC : +jz4750d_timer_set_count (TIMER_CLOCKEVENT ,0 ); +jz4750d_timer_set_period (TIMER_CLOCKEVENT , jz4750d_jiffies_per_tick); +case CLOCK_EVT_MODE_RESUME : +jz4750d_timer_irq_full_enable (TIMER_CLOCKEVENT ); +jz4750d_timer_enable (TIMER_CLOCKEVENT ); +break ; +case CLOCK_EVT_MODE_ONESHOT : +case CLOCK_EVT_MODE_SHUTDOWN : +jz4750d_timer_disable (TIMER_CLOCKEVENT ); +break ; +default : +break ; + } +} + +static int jz4750d_clockevent_set_next (unsigned long evt, +struct clock_event_device *cd) +{ +jz4750d_timer_set_count (TIMER_CLOCKEVENT ,0 ); +jz4750d_timer_set_period (TIMER_CLOCKEVENT , evt); +jz4750d_timer_enable (TIMER_CLOCKEVENT ); + +return 0 ; +} + +static struct clock_event_device jz4750d_clockevent = { + .name ="jz4750d-timer" , + .features =CLOCK_EVT_FEAT_PERIODIC , + .set_next_event = jz4750d_clockevent_set_next, + .set_mode = jz4750d_clockevent_set_mode, + .rating =200 , + .irq =JZ4750D_IRQ_TCU1 , +}; + +static struct irqaction timer_irqaction = { + .handler = jz4750d_clockevent_irq, + .flags =IRQF_DISABLED |IRQF_PERCPU |IRQF_TIMER , + .name ="jz4750d-timerirq" , + .dev_id = &jz4750d_clockevent, +}; + +void __init plat_time_init (void ) +{ +int ret; +uint32_t clk_rate; + +jz4750d_timer_init (); + + clk_rate = jz4750d_clock_bdata.ext_rate >>4 ; + jz4750d_jiffies_per_tick =DIV_ROUND_CLOSEST (clk_rate,HZ ); + +clockevent_set_clock (&jz4750d_clockevent, clk_rate); + jz4750d_clockevent.min_delta_ns = +clockevent_delta2ns (100 , &jz4750d_clockevent); + jz4750d_clockevent.max_delta_ns = +clockevent_delta2ns (0xffff , &jz4750d_clockevent); + jz4750d_clockevent.cpumask =cpumask_of (0 ); + +jz4750d_timer_irq_full_disable (TIMER_CLOCKEVENT ); + +clockevents_register_device (&jz4750d_clockevent); + + ret =clocksource_register_hz (&jz4750d_clocksource, clk_rate); + +if (ret) +printk (KERN_ERR "Failed to register clocksource: %d\n" , ret); + +setup_irq (JZ4750D_IRQ_TCU1 , &timer_irqaction); + +jz4750d_timer_set_ctrl (TIMER_CLOCKEVENT ,JZ_TIMER_CTRL_PRESCALE_16 + |JZ_TIMER_CTRL_SRC_EXT ); +jz4750d_ostimer_set_ctrl (JZ_OSTIMER_CTRL_PRESCALE_16 + |JZ_OSTIMER_CTRL_SRC_EXT ); + +jz4750d_timer_set_period (TIMER_CLOCKEVENT , jz4750d_jiffies_per_tick); +jz4750d_timer_irq_full_enable (TIMER_CLOCKEVENT ); + +jz4750d_ostimer_set_period (0xffffffff ); + +jz4750d_timer_enable (TIMER_CLOCKEVENT ); +jz4750d_timer_start (TIMER_CLOCKEVENT ); +jz4750d_ostimer_enable (); +jz4750d_ostimer_start (); +}
Signature · 1 line
1.7.10.4
RFC 4/13 MIPS: JZ4750D: Add timer support
In reply to Antony PavlovAdd support for the timer/counter unit on a JZ4750D SoC. This code is used as a common base for the JZ4750D clocksource/clockevent implementation and PWM support.
--- arch/mips/include/asm/mach-jz4750d/timer.h | 21 ++++ arch/mips/jz4750d/timer.c | 49 ++++++++ arch/mips/jz4750d/timer.h | 182 ++++++++++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 arch/mips/include/asm/mach-jz4750d/timer.h create mode 100644 arch/mips/jz4750d/timer.c create mode 100644 arch/mips/jz4750d/timer.h
arch/mips/include/asm/mach-jz4750d/timer.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D platform timer support +* +* based on JZ4740 platform timer support +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#ifndef __ASM_MACH_JZ4750D_TIMER +#define __ASM_MACH_JZ4750D_TIMER + +void jz4750d_timer_enable_watchdog (void ); +void jz4750d_timer_disable_watchdog (void ); + +#endif
arch/mips/jz4750d/timer.c new file +49 -0
49 lines not on this page · raw message
arch/mips/jz4750d/timer.h new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 9/13 MIPS: JZ4750D: Add prom support
In reply to Antony PavlovAdd support for initializing arcs_cmdline on JZ4750D based machines and provides a prom_putchar implementation.
--- arch/mips/jz4750d/prom.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 arch/mips/jz4750d/prom.c
arch/mips/jz4750d/prom.c new file +67 -0
@@ -0,0 +1,67 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D SoC prom code +* +* based on JZ4740 SoC prom code +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/string.h> + +#include <linux/serial_reg.h> + +#include <asm/bootinfo.h> +#include <asm/mach-jz4750d/base.h> + +static __init void jz4750d_init_cmdline (int argc,char *argv[]) +{ +unsigned int count =COMMAND_LINE_SIZE -1 ; +int i; +char *dst = &(arcs_cmdline[0 ]); +char *src; + +for (i =1 ; i < argc && count; ++i) { + src = argv[i]; +while (*src && count) { + *dst++ = *src++; + --count; + } + *dst++ =' ' ; + } +if (i >1 ) + --dst; + + *dst =0 ; +} + +void __init prom_init (void ) +{ +jz4750d_init_cmdline ((int )fw_arg0, (char **)fw_arg1); + mips_machtype =MACH_INGENIC_JZ4750D ; +} + +void __init prom_free_prom_memory (void ) +{ +} + +#define UART_REG (_reg) ((void __iomem *)CKSEG1ADDR(JZ4750D_UART1_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 )); +}
Signature · 1 line
1.7.10.4
RFC 10/13 MIPS: JZ4750D: Add platform UART devices
In reply to Antony PavlovAdd platform devices for the JZ4750D platform UART drivers.
--- arch/mips/include/asm/mach-jz4750d/platform.h | 22 +++++++ arch/mips/jz4750d/platform.c | 84 +++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 arch/mips/include/asm/mach-jz4750d/platform.h create mode 100644 arch/mips/jz4750d/platform.c
arch/mips/include/asm/mach-jz4750d/platform.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2012, Antony Pavlov <[email protected]> +* JZ4750D platform device definitions +* +* based on JZ4740 platform device definitions +* Copyright (C) 2010, Lars-Peter Clausen <[email protected]> +* +* 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. +* +*/ + +#ifndef __JZ4750D_PLATFORM_H__ +#define __JZ4750D_PLATFORM_H__ + +#include <linux/platform_device.h> + +void jz4750d_serial_device_register (void ); + +#endif /* __JZ4750D_PLATFORM_H__ */
arch/mips/jz4750d/platform.c new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 11/13 MIPS: JZ4750D: Add Kbuild files
In reply to Antony PavlovAdd the Kbuild files for the JZ4750D architecture and adds JZ4750D support to the MIPS Kbuild files.
--- arch/mips/Kbuild.platforms | 1 + arch/mips/Kconfig | 11 +++++++++++ arch/mips/jz4750d/Kconfig | 5 +++++ arch/mips/jz4750d/Makefile | 10 ++++++++++ arch/mips/jz4750d/Platform | 3 +++ 5 files changed, 30 insertions(+) create mode 100644 arch/mips/jz4750d/Kconfig create mode 100644 arch/mips/jz4750d/Makefile create mode 100644 arch/mips/jz4750d/Platform
arch/mips/Kbuild.platforms +1 -0
@@ -11,6 +11,7 @@ platforms += dec platforms += emma platforms += jazz platforms += jz4740 +platforms += jz4750d platforms += lantiq platforms += lasat platforms += loongson
arch/mips/Kconfig +11 -0
@@ -224,6 +224,16 @@ config MACH_JZ4740 select HAVE_CLK select GENERIC_IRQ_CHIP +config MACH_JZ4750D + bool "Ingenic JZ4750D based machines" + select SYS_HAS_CPU_MIPS32_R1 + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_LITTLE_ENDIAN + select DMA_NONCOHERENT + select IRQ_CPU + select SYS_HAS_EARLY_PRINTK + select HAVE_CLK + config LANTIQ bool "Lantiq based platforms" select DMA_NONCOHERENT
@@ -843,6 +853,7 @@ source "arch/mips/bcm47xx/Kconfig" source "arch/mips/bcm63xx/Kconfig" source "arch/mips/jazz/Kconfig" source "arch/mips/jz4740/Kconfig" +source "arch/mips/jz4750d/Kconfig" source "arch/mips/lantiq/Kconfig" source "arch/mips/lasat/Kconfig" source "arch/mips/pmc-sierra/Kconfig"
arch/mips/jz4750d/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +choice + prompt "Machine type" + depends on MACH_JZ4750D + +endchoice
arch/mips/jz4750d/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# +# Makefile for the Ingenic JZ4750D. +# + +# Object file lists. + +obj-y += prom.o irq.o time.o reset.o setup.o +obj-y += clock.o platform.o timer.o serial.o + +obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o
arch/mips/jz4750d/Platform new file +3 -0
@@ -0,0 +1,3 @@ +platform-$(CONFIG_MACH_JZ4750D) += jz4750d/ +cflags-$(CONFIG_MACH_JZ4750D) += -I$(srctree)/arch/mips/include/asm/mach-jz4750d +load-$(CONFIG_MACH_JZ4750D) += 0xffffffff80010000
Signature · 1 line
1.7.10.4
RFC 12/13 MIPS: JZ4750D: Add rzx50 board support
In reply to Antony PavlovAdd support for the Ritmix RZX-50 portable game console.
--- arch/mips/jz4750d/Kconfig | 4 ++++ arch/mips/jz4750d/Makefile | 3 +++ arch/mips/jz4750d/board-rzx50.c | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 arch/mips/jz4750d/board-rzx50.c
arch/mips/jz4750d/Kconfig +4 -0
@@ -1,5 +1,9 @@ choice prompt "Machine type" depends on MACH_JZ4750D + default JZ4750D_RZX50 + +config JZ4750D_RZX50 + bool "Ritmix RZX-50" endchoice
arch/mips/jz4750d/Makefile +3 -0
@@ -8,3 +8,6 @@ obj-y += prom.o irq.o time.o reset.o setup.o obj-y += clock.o platform.o timer.o serial.o obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o + +# board specific support +obj-$(CONFIG_JZ4750D_RZX50) += board-rzx50.o
arch/mips/jz4750d/board-rzx50.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 13/13 MIPS: rzx50: Add defconfig file
In reply to Antony Pavlov--- arch/mips/configs/ritmix-rzx50_defonfig | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 arch/mips/configs/ritmix-rzx50_defonfig
arch/mips/configs/ritmix-rzx50_defonfig new file +63 -0
@@ -0,0 +1,63 @@ +CONFIG_MACH_JZ4750D=y +CONFIG_HZ_100=y +CONFIG_KEXEC=y +# CONFIG_SECCOMP is not set +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_SWAP is not set +CONFIG_SYSVIPC=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="/home/antony/git/gcwnow-buildroot.git/output/images/rootfs.cpio" +CONFIG_SYSCTL_SYSCALL=y +CONFIG_EMBEDDED=y +# CONFIG_VM_EVENT_COUNTERS is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_LBDAF is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_SUSPEND is not set +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_IPV6 is not set +# CONFIG_WIRELESS is not set +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +# CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_NETDEVICES=y +# CONFIG_ETHERNET is not set +# CONFIG_WLAN is not set +# CONFIG_INPUT is not set +# CONFIG_SERIO is not set +# CONFIG_VT is not set +CONFIG_LEGACY_PTY_COUNT=2 +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=2 +CONFIG_SERIAL_8250_RUNTIME_UARTS=2 +# CONFIG_HW_RANDOM is not set +# CONFIG_HWMON is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_PROC_KCORE=y +CONFIG_TMPFS=y +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_DEBUG_FS=y +# CONFIG_FTRACE is not set +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="mem=64M root=/dev/loop0 ro rdinit=/bin/sh console=ttyS1,57600 panic=3" +CONFIG_CMDLINE_OVERRIDE=y
Signature · 1 line
1.7.10.4
Quoted 27 lines · Antony Pavlov
AFAIK the single known chip in Ingenic JZ4750D line is JZ4755. It has just the same CPU core as JZ4740, but another set of peripherals (though the program model for the most of the peripherals is the same).
+-----------------+--------------+--------------+ | | JZ4755 | JZ4740 | +-----------------+--------------+--------------+ | UART | 3 | 4 | | MSC (mmc/sd) | 2 | 1 | | GPIO | 5x32 | 4x32 | | TCU (timers) | 6x16 + 1x32 | 8x16 | | USB | device 2.0 | host 1.1 | | | | device 2.0 | +-----------------+--------------+--------------+The most significant advantage of the JZ4755 chip is the second MIPS core dedicated for image processing. Also JZ4755 is made with use of more precise technology and it can run on the higher clock rate (approx. 433 MHz for JZ4755 vs 336 MHz for JZ4740).
The JZ4755 is used in some game consoles:
* Ritmix RZX-50;
* Dingoo A320E/A380;
* GameLinBox.
Quoted 7 lines
This patch series based on the work of Lars-Peter Clausen. To tell the truth it is the Lars-Peter Clausen's patches with some fixes and changes.
As most of the code for JZ4750D is very close to code for JZ4740 we can incorporate the code for JZ4750D to the code for JZ4740 to avoid code duplication.
Yes, definitely agreed. Most of the peripherals are similar enough that they can be supported by a shared driver. I actually started working on this some time ago, but never finished it, because other things took priority. The code can be found here:
http://projects.qi-hardware.com/index.php/p/qi-kernel/source/tree/jz47xx-2.6.38/arch/mips/jz47xx
The code is based on 2.6.38 and is a bit outdated by now, but I think it gets the idea over quite well. And most of the patches touching jz47xx related code are still valid as well.
As for the renaming I'm not so sure if it is really necessary. We often stick we the name for the driver or architecture version which was first supported by the kernel and add note in Kconfig and comments that the driver also supports other version/variants of the peripheral or SoC.
- Lars
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 5 lines · Lars-Peter Clausen
As for the renaming I'm not so sure if it is really necessary. We often stick we the name for the driver or architecture version which was first supported by the kernel and add note in
Kconfigand comments that the driver also supports other version/variants of the peripheral or SoC.
We currently have 'jz4740' and 'jz4770' directories. I think putting the jz4750d code into 'jz4740' is a good idea too. Perhaps someday a 'jz47xx' directory could be possible, but not sure it is worth the work.
- -Steve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlCG9qgACgkQgyK5H2Ic36f+CACfTGI06BoH5wXS5SXeN2PBqDI0 FkUAoJRV8473SruXkIy4ZF6RXYg3l873
=eK1h
-----END PGP SIGNATURE-----
Quoted 9 lines · Steven J. Hill
Quoted 4 lines · Lars-Peter Clausen
As for the renaming I'm not so sure if it is really necessary. We often stick we the name for the driver or architecture version which was first supported by the kernel and add note in
Kconfigand comments that the driver also supports other version/variants of the peripheral or SoC.We currently have 'jz4740' and 'jz4770' directories. I think putting the jz4750d code into 'jz4740' is a good idea too. Perhaps someday a 'jz47xx' directory could be possible, but not sure it is worth the work.
In my opinion it is more effort to maintain these as separate subarchitectures. The peripherals are just to similar. Making a change to one of the jz4740 drivers will likely require the same change to the jz4770 driver.
- Lars
Re: [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
In reply to Antony PavlovQuoted 2 lines · On Tuesday 23 October 2012 21:43:59 Antony Pavlov wrote:
Add the
Kbuildfiles for the JZ4750D architecture and adds JZ4750D support to the MIPSKbuildfiles.
[snip]
arch/mips/jz4750d/Platform line 3
Quoted 10 lines
arch/mips/jz4750d/Platform new file +3
-1@@ -0,0 +1,3 @@ +platform-$(CONFIG_MACH_JZ4750D) += jz4750d/ +cflags-$(CONFIG_MACH_JZ4750D) += -I$(srctree)/arch/mips/include/asm/mach-jz4750d +load-$(CONFIG_MACH_JZ4750D) += 0xffffffff80010000
What is the purpose of padding the load address to 64 bits?
The reason I'm asking is that we encountered a bug with that when creating a u-boot image on a 32-bit host machine: the mkimage tool will only parse the first 8 hex digits and then inserts the wrong load address into the uImage.
Bye,
Maarten
Re: [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
Quoted 5 lines · Maarten ter Huurne
What is the purpose of padding the load address to 64 bits?
The reason I'm asking is that we encountered a bug with that when creating a u-boot image on a 32-bit host machine: the mkimage tool will only parse the first 8 hex digits and then inserts the wrong load address into the uImage.
Ld internally uses 64 bit addresses. Also, for platforms that support 32 bit and 64 bit kernels we'd have to specify two values that only differ by the sign extension in the upper bits.
Ralf
Re: [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
In reply to Maarten ter HuurneQuoted 17 lines · Maarten ter Huurne
Quoted 2 lines · On Tuesday 23 October 2012 21:43:59 Antony Pavlov wrote:
Add the
Kbuildfiles for the JZ4750D architecture and adds JZ4750D support to the MIPSKbuildfiles.[snip]
arch/mips/jz4750d/Platform line 3
Quoted 10 lines
arch/mips/jz4750d/Platform new file +3
-1@@ -0,0 +1,3 @@ +platform-$(CONFIG_MACH_JZ4750D) += jz4750d/ +cflags-$(CONFIG_MACH_JZ4750D) += -I$(srctree)/arch/mips/include/asm/mach-jz4750d +load-$(CONFIG_MACH_JZ4750D) += 0xffffffff80010000What is the purpose of padding the load address to 64 bits?
Quoted 3 lines
The reason I'm asking is that we encountered a bug with that when creating a u-boot image on a 32-bit host machine: the mkimage tool will only parse the first 8 hex digits and then inserts the wrong load address into the uImage.
I have just copied jz4740/Platform.
I don't use U-Boot, so I have never faced this problem.
Signature · 2 lines
Best regards, Antony Pavlov
Re: [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
In reply to Maarten ter HuurneQuoted 17 lines · On Wednesday 24 October 2012 18:16:35 Maarten ter Huurne wrote:
Quoted 2 lines · On Tuesday 23 October 2012 21:43:59 Antony Pavlov wrote:
Add the
Kbuildfiles for the JZ4750D architecture and adds JZ4750D support to the MIPSKbuildfiles.[snip]
arch/mips/jz4750d/Platform line 3
Quoted 10 lines
arch/mips/jz4750d/Platform new file +3
-1@@ -0,0 +1,3 @@ +platform-$(CONFIG_MACH_JZ4750D) += jz4750d/ +cflags-$(CONFIG_MACH_JZ4750D) += -I$(srctree)/arch/mips/include/asm/mach-jz4750d +load-$(CONFIG_MACH_JZ4750D) += 0xffffffff80010000What is the purpose of padding the load address to 64 bits?
Quoted 3 lines
The reason I'm asking is that we encountered a bug with that when creating a u-boot image on a 32-bit host machine: the mkimage tool will only parse the first 8 hex digits and then inserts the wrong load address into the uImage.
AFAIR u-boot's mkimage expects 32-bits quantities as a load address, so I would not be surprised that using this line as-is as an input parameter to mkimage does not give yout the expected result.
Signature · 1 line
Florian
Re: [RFC 11/13] MIPS: JZ4750D: Add Kbuild files
Quoted 20 lines · On Wednesday 24 October 2012 19:43:25 Florian Fainelli wrote:
Quoted 19 lines · On Wednesday 24 October 2012 18:16:35 Maarten ter Huurne wrote:
Quoted 2 lines · On Tuesday 23 October 2012 21:43:59 Antony Pavlov wrote:
Add the
Kbuildfiles for the JZ4750D architecture and adds JZ4750D support to the MIPSKbuildfiles.[snip]
arch/mips/jz4750d/Platform line 3
Quoted 10 lines
arch/mips/jz4750d/Platform new file +3
-1@@ -0,0 +1,3 @@ +platform-$(CONFIG_MACH_JZ4750D) += jz4750d/ +cflags-$(CONFIG_MACH_JZ4750D) += -I$(srctree)/arch/mips/include/asm/mach-jz4750d +load-$(CONFIG_MACH_JZ4750D) += 0xffffffff80010000What is the purpose of padding the load address to 64 bits?
Quoted 8 lines
Quoted 4 lines
The reason I'm asking is that we encountered a bug with that when creating a u-boot image on a 32-bit host machine: the mkimage tool will only parse the first 8 hex digits and then inserts the wrong load address into the uImage.
AFAIR u-boot's mkimage expects 32-bits quantities as a load address, so I would not be surprised that using this line as-is as an input parameter to mkimage does not give yout the expected result.
The actual uImage format supports only 32-bit addresses, but mkimage is inconsistent in its handling of 64-bit addresses: if the tool is compiled for x86_64 it parses all 16 hex digits and uses the lower 32 bits, but if it is compiled for x86 it parses only the first 8 hex digits and the resulting image won't boot.
There is no "uImage" target for MIPS in the mainline kernel; we added our own and it indeed passes $(VMLINUX_LOAD_ADDRESS) to mkimage as-is on the command line. Since Ralf indicated that there are good reasons for sign extending the address, I think I'll have to change how it is passed to mkimage.
Bye,
Maarten