sh updates
Subsystems (4)
cover sh updates
This includes some various updates for sh. Including a new clock and timer API, DMA updates, overhauling some of the I/O routines to allow for further board cleanup, as well as shuffling some code around for reuse on some new CPU subtypes.
Pretty much all of the changes are isolated to arch/sh and include/asm-sh.
PATCH 1/8 sh: Consolidate hp620/hp680/hp690 targets into hp6xx.
Most of the reasons for keeping these separate before was due to hp690 discontig, and since we have a workaround for that now (abusing some shadow space so everything is magically contiguous), there's no reason to keep the targets separate.
---
arch/sh/boards/hp6xx/Makefile | 6 arch/sh/boards/hp6xx/hp620/Makefile | 6 arch/sh/boards/hp6xx/hp620/mach.c | 52 -- arch/sh/boards/hp6xx/hp620/setup.c | 45 -- arch/sh/boards/hp6xx/hp680/Makefile | 6 arch/sh/boards/hp6xx/hp680/mach.c | 53 -- arch/sh/boards/hp6xx/hp680/setup.c | 41 - arch/sh/boards/hp6xx/hp690/Makefile | 6 arch/sh/boards/hp6xx/hp690/mach.c | 48 -- arch/sh/boards/hp6xx/mach.c | 46 ++ arch/sh/boards/hp6xx/setup.c | 55 ++ arch/sh/configs/hp680_defconfig | 626 ------------------------------ arch/sh/configs/hp6xx_defconfig | 743 ++++++++++++++++++++++++++++++++++++ arch/sh/tools/mach-types | 7 drivers/input/touchscreen/Kconfig | 2 15 files changed, 853 insertions(+), 889 deletions(-)
arch/sh/boards/hp6xx/Makefile +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the HP6xx specific parts of the kernel +# + +obj-y := mach.o setup.o +
arch/sh/boards/hp6xx/hp620/Makefile +0 -6
@@ -1,6 +0,0 @@ -# -# Makefile for the HP620 specific parts of the kernel -# - -obj-y := mach.o setup.o -
arch/sh/boards/hp6xx/hp620/mach.c +0 -52
52 lines not on this page · raw message
arch/sh/boards/hp6xx/hp620/setup.c +0 -45
45 lines not on this page · raw message
arch/sh/boards/hp6xx/hp680/Makefile +0 -6
@@ -1,6 +0,0 @@ -# -# Makefile for the HP680 specific parts of the kernel -# - -obj-y := mach.o setup.o -
arch/sh/boards/hp6xx/hp680/mach.c +0 -53
53 lines not on this page · raw message
arch/sh/boards/hp6xx/hp680/setup.c +0 -41
41 lines not on this page · raw message
arch/sh/boards/hp6xx/hp690/Makefile +0 -6
@@ -1,6 +0,0 @@ -# -# Makefile for the HP690 specific parts of the kernel -# - -obj-y := mach.o -
arch/sh/boards/hp6xx/hp690/mach.c +0 -48
48 lines not on this page · raw message
arch/sh/boards/hp6xx/mach.c +46 -0
46 lines not on this page · raw message
arch/sh/boards/hp6xx/setup.c +55 -0
55 lines not on this page · raw message
arch/sh/configs/hp680_defconfig +0 -626
626 lines not on this page · raw message
arch/sh/configs/hp6xx_defconfig +743 -0
743 lines not on this page · raw message
arch/sh/tools/mach-types +2 -5
@@ -7,13 +7,10 @@ # SE SH_SOLUTION_ENGINE 7751SE SH_7751_SOLUTION_ENGINE -7300SE SH_7300_SOLUTION_ENGINE +7300SE SH_7300_SOLUTION_ENGINE 73180SE SH_73180_SOLUTION_ENGINE 7751SYSTEMH SH_7751_SYSTEMH -HP600 SH_HP600 -HP620 SH_HP620 -HP680 SH_HP680 -HP690 SH_HP690 +HP6XX SH_HP6XX HD64461 HD64461 HD64465 HD64465 SH2000 SH_SH2000
drivers/input/touchscreen/Kconfig +1 -1
@@ -85,7 +85,7 @@ config TOUCHSCREEN_HP600 tristate "HP Jornada 680/690 touchscreen" - depends on SH_HP600 && SH_ADC + depends on SH_HP6XX && SH_ADC help Say Y here if you have a HP Jornada 680 or 690 and want to support the built-in touchscreen.
PATCH 2/8 sh: DMA updates
In reply to Paul MundtThis extends the current SH DMA API somewhat to support a proper virtual channel abstraction, and also works to represent this through the driver model by giving each DMAC its own platform device.
There's also a few other minor changes to support a few new CPU subtypes, and make TEI generation for the SH DMAC configurable.
---
arch/sh/drivers/dma/dma-api.c | 51 +++++++++++---- arch/sh/drivers/dma/dma-g2.c | 3 arch/sh/drivers/dma/dma-isa.c | 20 ++--- arch/sh/drivers/dma/dma-pvr2.c | 3 arch/sh/drivers/dma/dma-sh.c | 134 ++++++++++++++++++++++++---------------- arch/sh/drivers/dma/dma-sh.h | 44 +++++++++---- arch/sh/drivers/dma/dma-sysfs.c | 31 +++++++-- arch/sh/kernel/cpu/bus.c | 2 include/asm-sh/bus-sh.h | 1 include/asm-sh/cpu-sh3/dma.h | 31 ++++++++- include/asm-sh/cpu-sh4/dma.h | 52 ++++++++++++--- include/asm-sh/dma-mapping.h | 25 +++---- include/asm-sh/dma.h | 14 +++- 13 files changed, 291 insertions(+), 120 deletions(-)
arch/sh/drivers/dma/dma-api.c +37 -14
@@ -3,7 +3,7 @@* * SuperH-specific DMA management API * -* Copyright (C) 2003, 2004 Paul Mundt +* Copyright (C) 2003, 2004, 2005 Paul Mundt * * 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
@@ -15,6 +15,7 @@#include <linux/spinlock.h> #include <linux/proc_fs.h> #include <linux/list.h> +#include <linux/platform_device.h> #include <asm/dma.h> DEFINE_SPINLOCK (dma_spin_lock);
@@ -55,16 +56,14 @@struct dma_info *get_dma_info (unsigned int chan) { -struct list_head *pos, *tmp; +struct dma_info *info;unsigned int total =0 ;/* * Look for each DMAC's range to determine who the owner of * the channel is. */ -list_for_each_safe (pos, tmp, ®istered_dmac_list) { - struct dma_info *info = list_entry(pos, struct dma_info, list); - +list_for_each_entry (info, ®istered_dmac_list, list) { total += info->nr_channels;if (chan > total)continue ;
@@ -75,6 +74,20 @@return NULL ; } +static unsigned int get_nr_channels (void ) +{ +struct dma_info *info; +unsigned int nr =0 ; + +if (unlikely (list_empty (®istered_dmac_list))) +return nr; + +list_for_each_entry (info, ®istered_dmac_list, list) + nr += info->nr_channels; + +return nr; +} +struct dma_channel *get_dma_channel (unsigned int chan) {struct dma_info *info =get_dma_info (chan);
@@ -173,7 +186,7 @@static int dma_read_proc (char *buf,char **start,off_t off,int len,int *eof,void *data) { -struct list_head *pos, *tmp; +struct dma_info *info;char *p = buf;if (list_empty (®istered_dmac_list))
@@ -182,8 +195,7 @@/* * Iterate over each registered DMAC */ -list_for_each_safe (pos, tmp, ®istered_dmac_list) { - struct dma_info *info = list_entry(pos, struct dma_info, list); +list_for_each_entry (info, ®istered_dmac_list, list) {int i;/*
@@ -205,9 +217,9 @@#endif -int __init register_dmac (struct dma_info *info) +int register_dmac (struct dma_info *info) { -int i; +unsigned int total_channels, i;INIT_LIST_HEAD (&info->list);
@@ -217,6 +229,11 @@BUG_ON ((info->flags &DMAC_CHANNELS_CONFIGURED ) && !info->channels); + info->pdev =platform_device_register_simple ((char *)info->name,-1 , +NULL ,0 ); +if (IS_ERR (info->pdev)) +return PTR_ERR (info->pdev); +/* * Don't touch pre-configured channels */
@@ -232,10 +249,12 @@memset (info->channels,0 , size); } + total_channels =get_nr_channels ();for (i =0 ; i < info->nr_channels; i++) {struct dma_channel *chan = info->channels + i; chan->chan = i; + chan->vchan = i + total_channels;memcpy (chan->dev_id,"Unused" ,7 );
@@ -245,9 +264,7 @@init_MUTEX (&chan->sem);init_waitqueue_head (&chan->wait_queue); -#ifdef CONFIG_SYSFS -dma_create_sysfs_files (chan); -#endif +dma_create_sysfs_files (chan, info); }list_add (&info->list, ®istered_dmac_list);
@@ -255,12 +272,18 @@return 0 ; } -void __exit unregister_dmac(struct dma_info *info) +void unregister_dmac (struct dma_info *info) { +unsigned int i; + +for (i =0 ; i < info->nr_channels; i++) +dma_remove_sysfs_files (info->channels + i, info); +if (!(info->flags &DMAC_CHANNELS_CONFIGURED ))kfree (info->channels);list_del (&info->list); +platform_device_unregister (info->pdev); }static int __init dma_api_init (void )
arch/sh/drivers/dma/dma-g2.c +2 -1
@@ -140,7 +140,7 @@ };static struct dma_info g2_dma_info = { - .name ="G2 DMA" , + .name ="g2_dmac" , .nr_channels =4 , .ops = &g2_dma_ops, .flags =DMAC_CHANNELS_TEI_CAPABLE ,
@@ -160,6 +160,7 @@ static void __exit g2_dma_exit(void) {free_irq (HW_EVENT_G2_DMA ,0 ); +unregister_dmac (&g2_dma_info); }subsys_initcall (g2_dma_init);
arch/sh/drivers/dma/dma-isa.c +10 -10
@@ -25,14 +25,14 @@* such, this code is meant for only the simplest of tasks (and shouldn't be * used in any new drivers at all). * -* It should also be noted that various functions here are labelled as -* being deprecated. This is due to the fact that the ops->xfer() method is -* the preferred way of doing things (as well as just grabbing the spinlock -* directly). As such, any users of this interface will be warned rather -* loudly. +* NOTE: ops->xfer() is the preferred way of doing things. However, there +* are some users of the ISA DMA API that exist in common code that we +* don't necessarily want to go out of our way to break, so we still +* allow for some compatability at that level. Any new code is strongly +* advised to run far away from the ISA DMA API and use the SH DMA API +* directly. */ - -unsigned long __deprecated claim_dma_lock (void ) +unsigned long claim_dma_lock (void ) {unsigned long flags;
@@ -42,19 +42,19 @@ }EXPORT_SYMBOL (claim_dma_lock); -void __deprecated release_dma_lock (unsigned long flags) +void release_dma_lock (unsigned long flags) {spin_unlock_irqrestore (&dma_spin_lock, flags); }EXPORT_SYMBOL (release_dma_lock); -void __deprecated disable_dma (unsigned int chan) +void disable_dma (unsigned int chan) {/* Nothing */ }EXPORT_SYMBOL (disable_dma); -void __deprecated enable_dma (unsigned int chan) +void enable_dma (unsigned int chan) {struct dma_info *info =get_dma_info (chan);struct dma_channel *channel = &info->channels[chan];
arch/sh/drivers/dma/dma-pvr2.c +2 -1
@@ -80,7 +80,7 @@ };static struct dma_info pvr2_dma_info = { - .name ="PowerVR 2 DMA" , + .name ="pvr2_dmac" , .nr_channels =1 , .ops = &pvr2_dma_ops, .flags =DMAC_CHANNELS_TEI_CAPABLE ,
@@ -98,6 +98,7 @@ {free_dma (PVR2_CASCADE_CHAN );free_irq (HW_EVENT_PVR2_DMA ,0 ); +unregister_dmac (&pvr2_dma_info); }subsys_initcall (pvr2_dma_init);
arch/sh/drivers/dma/dma-sh.c +82 -52
246 lines not on this page · raw message
arch/sh/drivers/dma/dma-sh.h +33 -11
66 lines not on this page · raw message
arch/sh/drivers/dma/dma-sysfs.c +26 -5
@@ -3,7 +3,7 @@* * sysfs interface for SH DMA API * -* Copyright (C) 2004 Paul Mundt +* Copyright (C) 2004, 2005 Paul Mundt * * 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
@@ -12,7 +12,9 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/platform_device.h> #include <linux/module.h> +#include <linux/err.h> #include <linux/string.h> #include <asm/dma.h>
@@ -77,7 +79,7 @@unsigned long config; config =simple_strtoul (buf,NULL ,0 ); -dma_configure_channel (channel->chan, config); +dma_configure_channel (channel->vchan, config);return count; }
@@ -111,12 +113,13 @@dma_ro_attr (count,"0x%08x\n" );dma_ro_attr (flags,"0x%08lx\n" ); -int __init dma_create_sysfs_files (struct dma_channel *chan) +int dma_create_sysfs_files (struct dma_channel *chan,struct dma_info *info) {struct sys_device *dev = &chan->dev; +char name[16 ];int ret; - dev->id = chan->chan; + dev->id = chan->vchan; dev->cls = &dma_sysclass; ret =sysdev_register (dev);
@@ -129,6 +132,24 @@sysdev_create_file (dev, &attr_flags);sysdev_create_file (dev, &attr_config); -return 0 ; +snprintf (name,sizeof (name),"dma%d" , chan->chan); +return sysfs_create_link (&info->pdev->dev.kobj, &dev->kobj, name); +} + +void dma_remove_sysfs_files (struct dma_channel *chan,struct dma_info *info) +{ +struct sys_device *dev = &chan->dev; +char name[16 ]; + +sysdev_remove_file (dev, &attr_dev_id); +sysdev_remove_file (dev, &attr_count); +sysdev_remove_file (dev, &attr_mode); +sysdev_remove_file (dev, &attr_flags); +sysdev_remove_file (dev, &attr_config); + +snprintf (name,sizeof (name),"dma%d" , chan->chan); +sysfs_remove_link (&info->pdev->dev.kobj, name); + +sysdev_unregister (dev); }
arch/sh/kernel/cpu/bus.c +2 -0
@@ -107,6 +107,8 @@/* This is needed for USB OHCI to work */ if (dev->dma_mask) dev->dev.dma_mask = dev->dma_mask; +if (dev->coherent_dma_mask) + dev->dev.coherent_dma_mask = dev->coherent_dma_mask;snprintf (dev->dev.bus_id,BUS_ID_SIZE ,"%s%u" , dev->name, dev->dev_id);
include/asm-sh/bus-sh.h +1 -0
@@ -21,6 +21,7 @@void *mapbase;unsigned int irq[6 ];u64 *dma_mask; +u64 coherent_dma_mask; };#define to_sh_dev (d) container_of((d), struct sh_dev, dev)
include/asm-sh/cpu-sh3/dma.h +30 -1
@@ -3,5 +3,34 @@#define SH_DMAC_BASE 0xa4000020 -#endif /* __ASM_CPU_SH3_DMA_H */ +/* Definitions for the SuperH DMAC */ +#define TM_BURST 0x00000020 +#define TS_8 0x00000000 +#define TS_16 0x00000008 +#define TS_32 0x00000010 +#define TS_128 0x00000018 + +#define CHCR_TS_MASK 0x18 +#define CHCR_TS_SHIFT 3 + +#define DMAOR_INIT DMAOR_DME +/* +* The SuperH DMAC supports a number of transmit sizes, we list them here, +* with their respective values as they appear in the CHCR registers. +*/ +enum { +XMIT_SZ_8BIT , +XMIT_SZ_16BIT , +XMIT_SZ_32BIT , +XMIT_SZ_128BIT , +}; + +static unsigned int ts_shift[] __attribute__ ((used)) = { + [XMIT_SZ_8BIT] = 0, + [XMIT_SZ_16BIT] = 1, + [XMIT_SZ_32BIT] = 2, + [XMIT_SZ_128BIT] = 4, +}; + +#endif /* __ASM_CPU_SH3_DMA_H */
include/asm-sh/cpu-sh4/dma.h +42 -10
59 lines not on this page · raw message
include/asm-sh/dma-mapping.h +13 -12
@@ -4,6 +4,7 @@#include <linux/config.h> #include <linux/mm.h> #include <asm/scatterlist.h> +#include <asm/cacheflush.h> #include <asm/io.h> extern struct bus_type pci_bus_type;
@@ -141,24 +142,24 @@ } } -static inline void dma_sync_single_for_cpu (struct device *dev, -dma_addr_t dma_handle,size_t size, -enum dma_data_direction dir) +static void dma_sync_single_for_cpu (struct device *dev, +dma_addr_t dma_handle,size_t size, +enum dma_data_direction dir) __attribute__ ((alias ("dma_sync_single" ))); -static inline void dma_sync_single_for_device (struct device *dev, -dma_addr_t dma_handle,size_t size, -enum dma_data_direction dir) +static void dma_sync_single_for_device (struct device *dev, +dma_addr_t dma_handle,size_t size, +enum dma_data_direction dir) __attribute__ ((alias ("dma_sync_single" ))); -static inline void dma_sync_sg_for_cpu (struct device *dev, -struct scatterlist *sg,int nelems, -enum dma_data_direction dir) +static void dma_sync_sg_for_cpu (struct device *dev, +struct scatterlist *sg,int nelems, +enum dma_data_direction dir) __attribute__ ((alias ("dma_sync_sg" ))); -static inline void dma_sync_sg_for_device (struct device *dev, -struct scatterlist *sg,int nelems, -enum dma_data_direction dir) +static void dma_sync_sg_for_device (struct device *dev, +struct scatterlist *sg,int nelems, +enum dma_data_direction dir) __attribute__ ((alias ("dma_sync_sg" )));static inline int dma_get_cache_alignment (void )
include/asm-sh/dma.h +11 -3
@@ -15,6 +15,7 @@#include <linux/spinlock.h> #include <linux/wait.h> #include <linux/sysdev.h> +#include <linux/device.h> #include <asm/cpu/dma.h> #include <asm/semaphore.h>
@@ -54,8 +55,8 @@* DMA channel capabilities / flags */ enum { -DMA_CONFIGURED =0x00 ,DMA_TEI_CAPABLE =0x01 , +DMA_CONFIGURED =0x02 , };extern spinlock_t dma_spin_lock;
@@ -74,7 +75,8 @@struct dma_channel {char dev_id[16 ]; -unsigned int chan; +unsigned int chan;/* Physical channel number */ +unsigned int vchan;/* Virtual channel number */ unsigned int mode;unsigned int count;
@@ -91,6 +93,8 @@ };struct dma_info { +struct platform_device *pdev; +const char *name;unsigned int nr_channels;unsigned long flags;
@@ -130,7 +134,11 @@#ifdef CONFIG_SYSFS /* arch/sh/drivers/dma/dma-sysfs.c */ -extern int dma_create_sysfs_files (struct dma_channel *); +extern int dma_create_sysfs_files (struct dma_channel *,struct dma_info *); +extern void dma_remove_sysfs_files (struct dma_channel *,struct dma_info *); +#else +#define dma_create_sysfs_file (channel, info) do { } while (0) +#define dma_remove_sysfs_file (channel, info) do { } while (0)#endif #ifdef CONFIG_PCI
PATCH 3/8 sh: kexec() support.
In reply to Paul MundtFrom: kogiidena <[email protected]>
This adds kexec() support for SH.
---
arch/sh/kernel/Makefile | 4 - arch/sh/kernel/machine_kexec.c | 112 +++++++++++++++++++++++++++++++++++++++ arch/sh/kernel/process.c | 10 +++ arch/sh/kernel/relocate_kernel.S | 102 +++++++++++++++++++++++++++++++++++ include/asm-sh/kexec.h | 33 +++++++++++ include/linux/kexec.h | 1 6 files changed, 259 insertions(+), 3 deletions(-)
arch/sh/kernel/Makefile +1 -3
@@ -17,6 +17,4 @@ obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - -USE_STANDARD_AS_RULE := true - +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
arch/sh/kernel/machine_kexec.c +112 -0
112 lines not on this page · raw message
arch/sh/kernel/relocate_kernel.S +102 -0
102 lines not on this page · raw message
include/asm-sh/kexec.h +33 -0
@@ -0,0 +1,33 @@ +#ifndef _SH_KEXEC_H +#define _SH_KEXEC_H + +/* +* KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. +* I.e. Maximum page that is mapped directly into kernel memory, +* and kmap is not required. +* +* Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct +* calculation for the amount of memory directly mappable into the +* kernel memory space. +*/ + +/* Maximum physical address we can use pages from */ +#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) +/* Maximum address we can reach in physical address mode */ +#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) +/* Maximum address we can use for the control code buffer */ +#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE + +#define KEXEC_CONTROL_CODE_SIZE 4096 + +/* The native architecture */ +#define KEXEC_ARCH KEXEC_ARCH_SH + +#ifndef __ASSEMBLY__ + +extern void machine_shutdown (void ); +extern void *crash_notes; + +#endif /* __ASSEMBLY__ */ + +#endif /* _SH_KEXEC_H */
include/linux/kexec.h +1 -0
@@ -119,6 +119,7 @@#define KEXEC_ARCH_PPC64 (21 << 16)#define KEXEC_ARCH_IA_64 (50 << 16)#define KEXEC_ARCH_S390 (22 << 16) +#define KEXEC_ARCH_SH (42 << 16)#define KEXEC_FLAGS (KEXEC_ON_CRASH)/* List of defined/legal kexec flags */
arch/sh/kernel/process.c +10 -0
@@ -71,6 +81,16 @@void machine_restart (char * __unused) { + +#ifdef CONFIG_KEXEC +struct kimage *image; + image =xchg (&kexec_image,0 ); +if (image) { +machine_shutdown (); +machine_kexec (image); + } +#endif +/* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ asmvolatile ("ldc %0, sr\n\t" "mov.l @%1, %0" : :"r" (0x10000000 ),"r" (0x80000001 ));
PATCH 4/8 sh: IRQ handler updates.
In reply to Paul MundtThis moves the various IRQ controller drivers into a new subdirectory, and also extends the INTC2 IRQ handler to also deal with SH7760 and SH7780 interrupts, rather than just ST-40.
The old CONFIG_SH_GENERIC has also been removed from the IRQ definitions, as new ports are expected to be based off of CONFIG_SH_UNKNOWN. Since there are plenty of incompatible machvecs, CONFIG_SH_GENERIC doesn't make sense anymore.
---
arch/sh/kernel/cpu/Makefile | 9 arch/sh/kernel/cpu/irq/Makefile | 7 arch/sh/kernel/cpu/irq/imask.c | 110 +++++++++++ arch/sh/kernel/cpu/irq/intc2.c | 284 ++++++++++++++++++++++++++++++ arch/sh/kernel/cpu/irq/ipr.c | 206 +++++++++++++++++++++ arch/sh/kernel/cpu/irq/pint.c | 169 +++++++++++++++++ arch/sh/kernel/cpu/irq_imask.c | 116 ------------ arch/sh/kernel/cpu/irq_ipr.c | 339 ----------------------------------- arch/sh/kernel/cpu/sh4/irq_intc2.c | 222 ----------------------- arch/sh/kernel/irq.c | 64 ++---- include/asm-sh/irq-sh73180.h | 16 - include/asm-sh/irq-sh7780.h | 349 +++++++++++++++++++++++++++++++++++++ include/asm-sh/irq.h | 143 ++++++++------- 13 files changed, 1240 insertions(+), 794 deletions(-)
arch/sh/kernel/cpu/Makefile +3 -6
@@ -2,15 +2,12 @@ # Makefile for the Linux/SuperH CPU-specifc backends. # -obj-y := irq_ipr.o irq_imask.o init.o bus.o +obj-y += irq/ init.o bus.o clock.o obj-$(CONFIG_CPU_SH2) += sh2/ obj-$(CONFIG_CPU_SH3) += sh3/ obj-$(CONFIG_CPU_SH4) += sh4/ -obj-$(CONFIG_SH_RTC) += rtc.o +obj-$(CONFIG_SH_RTC) += rtc.o obj-$(CONFIG_UBC_WAKEUP) += ubc.o -obj-$(CONFIG_SH_ADC) += adc.o - -USE_STANDARD_AS_RULE := true - +obj-$(CONFIG_SH_ADC) += adc.o
arch/sh/kernel/cpu/irq/Makefile +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Linux/SuperH CPU-specifc IRQ handlers. +# +obj-y += ipr.o imask.o + +obj-$(CONFIG_CPU_HAS_PINT_IRQ) += pint.o +obj-$(CONFIG_CPU_HAS_INTC2_IRQ) += intc2.o
arch/sh/kernel/cpu/irq/imask.c +110 -0
110 lines not on this page · raw message
arch/sh/kernel/cpu/irq/intc2.c +284 -0
284 lines not on this page · raw message
arch/sh/kernel/cpu/irq/ipr.c +206 -0
206 lines not on this page · raw message
arch/sh/kernel/cpu/irq/pint.c +169 -0
169 lines not on this page · raw message
arch/sh/kernel/cpu/irq_imask.c +0 -116
116 lines not on this page · raw message
arch/sh/kernel/cpu/irq_ipr.c +0 -339
339 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/irq_intc2.c +0 -222
222 lines not on this page · raw message
arch/sh/kernel/irq.c +26 -38
90 lines not on this page · raw message
include/asm-sh/irq-sh73180.h +8 -8
@@ -12,14 +12,14 @@#undef INTC_IPRC#undef INTC_IPRD -#undef DMTE0_IRQ -#undef DMTE1_IRQ -#undef DMTE2_IRQ -#undef DMTE3_IRQ -#undef DMTE4_IRQ -#undef DMTE5_IRQ -#undef DMTE6_IRQ -#undef DMTE7_IRQ +#undef DMTE0_IRQ +#undef DMTE1_IRQ +#undef DMTE2_IRQ +#undef DMTE3_IRQ +#undef DMTE4_IRQ +#undef DMTE5_IRQ +#undef DMTE6_IRQ +#undef DMTE7_IRQ#undef DMAE_IRQ#undef DMA_IPR_ADDR#undef DMA_IPR_POS
include/asm-sh/irq-sh7780.h +349 -0
349 lines not on this page · raw message
include/asm-sh/irq.h +78 -65
213 lines not on this page · raw message
PATCH 5/8 sh: I/O routine cleanups and ioremap() overhaul.
In reply to Paul MundtThis introduces a few changes in the way that the I/O routines are defined on SH, specifically so that things like the iomap API properly wrap through the machvec for board-specific quirks.
In addition to this, the old p3_ioremap() work is converted to a more generic __ioremap() that will map through the PMB if it's available, or fall back on page tables for everything else.
An alpha-like IO_CONCAT is also added so we can start to clean up the board-specific io.h mess, which will be handled in board update patches..
---
arch/sh/kernel/io.c | 41 ++++-- arch/sh/kernel/io_generic.c | 192 +++++++++++++---------------- arch/sh/mm/ioremap.c | 99 ++++++++++++--- include/asm-sh/io.h | 287 +++++++++++++++++++++++++------------------- include/asm-sh/io_generic.h | 88 ++++++------- include/asm-sh/machvec.h | 66 ++++------ 6 files changed, 438 insertions(+), 335 deletions(-)
arch/sh/kernel/io.c +28 -13
@@ -2,58 +2,73 @@* linux/arch/sh/kernel/io.c * * Copyright (C) 2000 Stuart Menefy +* Copyright (C) 2005 Paul Mundt * * Provide real functions which expand to whatever the header file defined. * Also definitions of machine independent IO functions. +* +* 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. */ - -#include <asm/io.h> #include <linux/module.h> +#include <asm/machvec.h> +#include <asm/io.h> /* * Copy data from IO memory space to "real" memory space. * This needs to be optimized. */ -void memcpy_fromio (void * to,unsigned long from,unsigned long count) +void memcpy_fromio (void *to,volatile void __iomem *from,unsigned long count) {char *p = to;while (count) { count--; - *p =readb (from); + *p =readb ((void __iomem *)from); p++; from++; } } - +EXPORT_SYMBOL (memcpy_fromio); +/* * Copy data from "real" memory space to IO memory space. * This needs to be optimized. */ -void memcpy_toio (unsigned long to,const void * from,unsigned long count) +void memcpy_toio (volatile void __iomem *to,const void *from,unsigned long count) {const char *p = from;while (count) { count--; -writeb (*p, to); +writeb (*p, (void __iomem *)to); p++; to++; } } - +EXPORT_SYMBOL (memcpy_toio); +/* * "memset" on IO memory space. * This needs to be optimized. */ -void memset_io (unsigned long dst,int c,unsigned long count) +void memset_io (volatile void __iomem *dst,int c,unsigned long count) {while (count) { count--; -writeb (c, dst); +writeb (c, (void __iomem *)dst); dst++; } } - -EXPORT_SYMBOL (memcpy_fromio); -EXPORT_SYMBOL (memcpy_toio);EXPORT_SYMBOL (memset_io); +void __iomem *ioport_map (unsigned long port,unsigned int nr) +{ +return sh_mv.mv_ioport_map (port, nr); +} +EXPORT_SYMBOL (ioport_map); + +void ioport_unmap (void __iomem *addr) +{ + sh_mv.mv_ioport_unmap (addr); +} +EXPORT_SYMBOL (ioport_unmap);
arch/sh/kernel/io_generic.c +87 -105
319 lines not on this page · raw message
arch/sh/mm/ioremap.c +81 -18
147 lines not on this page · raw message
include/asm-sh/io.h +168 -119
397 lines not on this page · raw message
include/asm-sh/io_generic.h +43 -45
94 lines not on this page · raw message
include/asm-sh/machvec.h +31 -35
81 lines not on this page · raw message
PATCH 6/8 sh: Simplistic clock framework.
In reply to Paul MundtThis adds a relatively simplistic clock framework for sh. The initial goal behind this is to clean up the arch/sh/kernel/time.c mess and to get the CPU subtype-specific frequency setting and calculation code moved somewhere more sensible.
This only deals with the core clocks at the moment, though it's trivial for other drivers to define their own clocks as desired.
---
arch/sh/boards/overdrive/Makefile | 2 arch/sh/boards/overdrive/setup.c | 6 arch/sh/boards/overdrive/time.c | 119 ------- arch/sh/kernel/cpu/clock.c | 287 ++++++++++++++++++ arch/sh/kernel/cpu/sh3/Makefile | 7 arch/sh/kernel/cpu/sh3/clock-sh3.c | 89 +++++ arch/sh/kernel/cpu/sh3/clock-sh7300.c | 78 ++++ arch/sh/kernel/cpu/sh3/clock-sh7705.c | 84 +++++ arch/sh/kernel/cpu/sh3/clock-sh7709.c | 96 ++++++ arch/sh/kernel/cpu/sh4/Makefile | 13 arch/sh/kernel/cpu/sh4/clock-sh4-202.c | 179 +++++++++++ arch/sh/kernel/cpu/sh4/clock-sh4.c | 80 +++++ arch/sh/kernel/cpu/sh4/clock-sh73180.c | 81 +++++ arch/sh/kernel/cpu/sh4/clock-sh7770.c | 73 ++++ arch/sh/kernel/cpu/sh4/clock-sh7780.c | 126 ++++++++ arch/sh/kernel/time.c | 518 ++------------------------------- include/asm-sh/clock.h | 61 +++ include/asm-sh/cpu-sh4/freq.h | 2 include/asm-sh/freq.h | 11 19 files changed, 1288 insertions(+), 624 deletions(-)
arch/sh/kernel/cpu/clock.c +287 -0
@@ -0,0 +1,287 @@ +/* +* arch/sh/kernel/cpu/clock.c - SuperH clock framework +* +* Copyright (C) 2005 Paul Mundt +* +* This clock framework is derived from the OMAP version by: +* +* Copyright (C) 2004 Nokia Corporation +* Written by Tuukka Tikkanen <[email protected]> +* +* 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. +*/ +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/list.h> +#include <linux/kref.h> +#include <linux/seq_file.h> +#include <linux/err.h> +#include <asm/clock.h> +#include <asm/timer.h> + +static LIST_HEAD (clock_list); +static DEFINE_SPINLOCK (clock_lock); +static DECLARE_MUTEX (clock_list_sem); + +/* +* Each subtype is expected to define the init routines for these clocks, +* as each subtype (or processor family) will have these clocks at the +* very least. These are all provided through the CPG, which even some of +* the more quirky parts (such as ST40, SH4-202, etc.) still have. +* +* The processor-specific code is expected to register any additional +* clock sources that are of interest. +*/ +static struct clk master_clk = { + .name ="master_clk" , + .flags =CLK_ALWAYS_ENABLED |CLK_RATE_PROPAGATES , +#ifdef CONFIG_SH_PCLK_FREQ_BOOL + .rate =CONFIG_SH_PCLK_FREQ , +#endif +}; + +static struct clk module_clk = { + .name ="module_clk" , + .parent = &master_clk, + .flags =CLK_ALWAYS_ENABLED |CLK_RATE_PROPAGATES , +}; + +static struct clk bus_clk = { + .name ="bus_clk" , + .parent = &master_clk, + .flags =CLK_ALWAYS_ENABLED |CLK_RATE_PROPAGATES , +}; + +static struct clk cpu_clk = { + .name ="cpu_clk" , + .parent = &master_clk, + .flags =CLK_ALWAYS_ENABLED , +}; + +/* +* The ordering of these clocks matters, do not change it. +*/ +static struct clk *onchip_clocks[] = { + &master_clk, + &module_clk, + &bus_clk, + &cpu_clk, +}; + +static void propagate_rate (struct clk *clk) +{ +struct clk *clkp; + +list_for_each_entry (clkp, &clock_list, node) { +if (likely (clkp->parent != clk)) +continue ; +if (likely (clkp->ops && clkp->ops->recalc)) + clkp->ops->recalc (clkp); + } +} + +int __clk_enable (struct clk *clk) +{ +/* +* See if this is the first time we're enabling the clock, some +* clocks that are always enabled still require "special" +* initialization. This is especially true if the clock mode +* changes and the clock needs to hunt for the proper set of +* divisors to use before it can effectively recalc. +*/ +if (unlikely (atomic_read (&clk->kref.refcount) ==1 )) +if (clk->ops && clk->ops->init) + clk->ops->init (clk); + +if (clk->flags &CLK_ALWAYS_ENABLED ) +return 0 ; + +if (likely (clk->ops && clk->ops->enable)) + clk->ops->enable (clk); + +kref_get (&clk->kref); +return 0 ; +} + +int clk_enable (struct clk *clk) +{ +unsigned long flags; +int ret; + +spin_lock_irqsave (&clock_lock, flags); + ret =__clk_enable (clk); +spin_unlock_irqrestore (&clock_lock, flags); + +return ret; +} + +static void clk_kref_release (struct kref *kref) +{ +/* Nothing to do */ +} + +void __clk_disable (struct clk *clk) +{ +if (clk->flags &CLK_ALWAYS_ENABLED ) +return ; + +kref_put (&clk->kref, clk_kref_release); +} + +void clk_disable (struct clk *clk) +{ +unsigned long flags; + +spin_lock_irqsave (&clock_lock, flags); +__clk_disable (clk); +spin_unlock_irqrestore (&clock_lock, flags); +} + +int clk_register (struct clk *clk) +{ +down (&clock_list_sem); + +list_add (&clk->node, &clock_list); +kref_init (&clk->kref); + +up (&clock_list_sem); + +return 0 ; +} + +void clk_unregister (struct clk *clk) +{ +down (&clock_list_sem); +list_del (&clk->node); +up (&clock_list_sem); +} + +inline unsigned long clk_get_rate (struct clk *clk) +{ +return clk->rate; +} + +int clk_set_rate (struct clk *clk,unsigned long rate) +{ +int ret = -EOPNOTSUPP ; + +if (likely (clk->ops && clk->ops->set_rate)) { +unsigned long flags; + +spin_lock_irqsave (&clock_lock, flags); + ret = clk->ops->set_rate (clk, rate); +spin_unlock_irqrestore (&clock_lock, flags); + } + +if (unlikely (clk->flags &CLK_RATE_PROPAGATES )) +propagate_rate (clk); + +return ret; +} + +void clk_recalc_rate (struct clk *clk) +{ +if (likely (clk->ops && clk->ops->recalc)) { +unsigned long flags; + +spin_lock_irqsave (&clock_lock, flags); + clk->ops->recalc (clk); +spin_unlock_irqrestore (&clock_lock, flags); + } + +if (unlikely (clk->flags &CLK_RATE_PROPAGATES )) +propagate_rate (clk); +} + +struct clk *clk_get (const char *id) +{ +struct clk *p, *clk =ERR_PTR (-ENOENT ); + +down (&clock_list_sem); +list_for_each_entry (p, &clock_list, node) { +if (strcmp (id, p->name) ==0 &&try_module_get (p->owner)) { + clk = p; +break ; + } + } +up (&clock_list_sem); + +return clk; +} + +void clk_put (struct clk *clk) +{ +if (clk && !IS_ERR (clk)) +module_put (clk->owner); +} + +void __init __attribute__ ((weak)) +arch_init_clk_ops (struct clk_ops **ops,int type) +{ +} + +int __init clk_init (void ) +{ +int i, ret =0 ; + +if (unlikely (!master_clk.rate)) +/* +* NOTE: This will break if the default divisor has been +* changed. +* +* No one should be changing the default on us however, +* expect that a sane value for CONFIG_SH_PCLK_FREQ will +* be defined in the event of a different divisor. +*/ + master_clk.rate =get_timer_frequency () *4 ; + +for (i =0 ; i <ARRAY_SIZE (onchip_clocks); i++) { +struct clk *clk = onchip_clocks[i]; + +arch_init_clk_ops (&clk->ops, i); + ret |=clk_register (clk); +clk_enable (clk); + } + +/* Kick the child clocks.. */ +propagate_rate (&master_clk); +propagate_rate (&bus_clk); + +return ret; +} + +int show_clocks (struct seq_file *m) +{ +struct clk *clk; + +list_for_each_entry_reverse (clk, &clock_list, node) { +unsigned long rate =clk_get_rate (clk); + +/* +* Don't bother listing dummy clocks with no ancestry +* that only support enable and disable ops. +*/ +if (unlikely (!rate && !clk->parent)) +continue ; + +seq_printf (m,"%-12s\t: %ld.%02ldMHz\n" , clk->name, + rate /1000000 , (rate %1000000 ) /10000 ); + } + +return 0 ; +} + +EXPORT_SYMBOL_GPL (clk_register); +EXPORT_SYMBOL_GPL (clk_unregister); +EXPORT_SYMBOL_GPL (clk_get); +EXPORT_SYMBOL_GPL (clk_put); +EXPORT_SYMBOL_GPL (clk_enable); +EXPORT_SYMBOL_GPL (clk_disable); +EXPORT_SYMBOL_GPL (__clk_enable); +EXPORT_SYMBOL_GPL (__clk_disable); +EXPORT_SYMBOL_GPL (clk_get_rate); +EXPORT_SYMBOL_GPL (clk_set_rate); +EXPORT_SYMBOL_GPL (clk_recalc_rate);
arch/sh/kernel/cpu/sh3/Makefile +7 -0
@@ -4,3 +4,10 @@ obj-y := ex.o probe.o +clock-$(CONFIG_CPU_SH3) := clock-sh3.o +clock-$(CONFIG_CPU_SUBTYPE_SH7300) := clock-sh7300.o +clock-$(CONFIG_CPU_SUBTYPE_SH7705) := clock-sh7705.o +clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o + +obj-y += $(clock-y) +
arch/sh/kernel/cpu/sh3/clock-sh3.c +89 -0
89 lines not on this page · raw message
arch/sh/kernel/cpu/sh3/clock-sh7300.c +78 -0
78 lines not on this page · raw message
arch/sh/kernel/cpu/sh3/clock-sh7705.c +84 -0
84 lines not on this page · raw message
arch/sh/kernel/cpu/sh3/clock-sh7709.c +96 -0
96 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/Makefile +11 -2
@@ -4,7 +4,16 @@ obj-y := ex.o probe.o -obj-$(CONFIG_SH_FPU) += fpu.o -obj-$(CONFIG_CPU_SUBTYPE_ST40STB1) += irq_intc2.o +obj-$(CONFIG_SH_FPU) += fpu.o obj-$(CONFIG_SH_STORE_QUEUES) += sq.o +# Primary on-chip clocks (common) +clock-$(CONFIG_CPU_SH4) := clock-sh4.o +clock-$(CONFIG_CPU_SUBTYPE_SH73180) := clock-sh73180.o +clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o +clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o + +# Additional clocks by subtype +clock-$(CONFIG_CPU_SUBTYPE_SH4_202) += clock-sh4-202.o + +obj-y += $(clock-y)
arch/sh/kernel/cpu/sh4/clock-sh4-202.c +179 -0
179 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/clock-sh4.c +80 -0
80 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/clock-sh73180.c +81 -0
81 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/clock-sh7770.c +73 -0
73 lines not on this page · raw message
arch/sh/kernel/cpu/sh4/clock-sh7780.c +126 -0
126 lines not on this page · raw message
arch/sh/kernel/time.c +32 -486
599 lines not on this page · raw message
arch/sh/boards/overdrive/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the STMicroelectronics Overdrive specific parts of the kernel # -obj-y := mach.o setup.o io.o irq.o led.o time.o +obj-y := mach.o setup.o io.o irq.o led.o obj-$(CONFIG_PCI) += fpga.o galileo.o pcidma.o
arch/sh/boards/overdrive/setup.c +1 -5
@@ -17,8 +17,6 @@#include <asm/overdrive/overdrive.h> #include <asm/overdrive/fpga.h> -extern void od_time_init (void ); -const char *get_system_type (void ) {return "SH7750 Overdrive" ;
@@ -31,11 +29,9 @@ {#ifdef CONFIG_PCI init_overdrive_fpga (); -galileo_init (); +galileo_init ();#endif - board_time_init = od_time_init; -/* Enable RS232 receive buffers */ writel (0x1e ,OVERDRIVE_CTRL ); }
arch/sh/boards/overdrive/time.c +0 -119
119 lines not on this page · raw message
include/asm-sh/clock.h +61 -0
61 lines not on this page · raw message
include/asm-sh/cpu-sh4/freq.h +2 -0
@@ -12,6 +12,8 @@#if defined(CONFIG_CPU_SUBTYPE_SH73180 )#define FRQCR 0xa4150000 +#elif defined(CONFIG_CPU_SUBTYPE_SH7780 ) +#define FRQCR 0xffc80000#else #define FRQCR 0xffc00000#endif
include/asm-sh/freq.h +0 -11
@@ -14,16 +14,5 @@#include <asm/cpu/freq.h> -/* arch/sh/kernel/time.c */ -extern void get_current_frequency_divisors (unsigned int *ifc,unsigned int *pfc,unsigned int *bfc); - -extern unsigned int get_ifc_divisor (unsigned int value); -extern unsigned int get_ifc_divisor (unsigned int value); -extern unsigned int get_ifc_divisor (unsigned int value); - -extern unsigned int get_ifc_value (unsigned int divisor); -extern unsigned int get_pfc_value (unsigned int divisor); -extern unsigned int get_bfc_value (unsigned int divisor); -#endif /* __KERNEL__ */ #endif /* __ASM_SH_FREQ_H */
PATCH 7/8 sh: Simple timer framework.
In reply to Paul MundtThis builds on some of the clock framework code to support a simple system timer interface.
---
arch/sh/kernel/timers/Makefile | 8 + arch/sh/kernel/timers/timer-tmu.c | 229 ++++++++++++++++++++++++++++++++++++++ arch/sh/kernel/timers/timer.c | 50 ++++++++ include/asm-sh/timer.h | 42 ++++++ 4 files changed, 329 insertions(+)
arch/sh/kernel/timers/Makefile +8 -0
@@ -0,0 +1,8 @@ +# +# Makefile for the various Linux/SuperH timers +# + +obj-y := timer.o + +obj-$(CONFIG_SH_TMU) += timer-tmu.o +
arch/sh/kernel/timers/timer-tmu.c +229 -0
229 lines not on this page · raw message
arch/sh/kernel/timers/timer.c +50 -0
50 lines not on this page · raw message
include/asm-sh/timer.h +42 -0
42 lines not on this page · raw message
PATCH 8/8 sh: Move CPU subtype configuration to its own Kconfig.
In reply to Paul MundtCurrently the CPU subtype options are cluttering up arch/sh/Kconfig somewhat. Given that, this moves all of that in to its own arch/sh/mm/Kconfig. Things like cache configuration are also moved to this new location.
This also adds support for strict CPU tuning on newer cores, which requires the addition of as-option.
---
Makefile | 7 arch/sh/Kconfig | 541 +++++++++++++++++++------------------------------- arch/sh/Kconfig.debug | 2 arch/sh/Makefile | 60 +++-- arch/sh/mm/Kconfig | 233 +++++++++++++++++++++ 5 files changed, 491 insertions(+), 352 deletions(-)
Makefile +7 -0
@@ -280,6 +280,13 @@ # cc support functions to be used (only) in arch/$(ARCH)/Makefile # See documentation in Documentation/kbuild/makefiles.txt +# as-option +# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) + +as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ + -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ + else echo "$(2)"; fi ;) + # cc-option # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
arch/sh/Kconfig +207 -334
743 lines not on this page · raw message
arch/sh/Kconfig.debug +1 -1
@@ -17,7 +17,7 @@ config EARLY_SCIF_CONSOLE bool "Use early SCIF console" - depends on CPU_SH4 + depends on CPU_SH4 || CPU_SH2A && !SH_STANDARD_BIOS config EARLY_PRINTK bool "Early printk support"
arch/sh/Makefile +43 -17
93 lines not on this page · raw message
arch/sh/mm/Kconfig +233 -0
233 lines not on this page · raw message