Misc. Alchemy updates
Subsystems (2)
cover Misc. Alchemy updates
This is a RFC for a series of patches I've been sitting on a while, it applies on top of latest linus-git (#3-#9 need to be applied in sequence).
These two are older; they've been updated a bit:
#1 improves stability of DB1200 board,
#2 is a buildfix for mtx-1 with gpiolib=n; the gpio api has
been updated with new functions, which this patch adds.
the other patches mainly replace au_readl/au_writel with __raw_* functions, and try to reduce the register address clutter in the au1000.h header. This was basically a single large patch broken down into smaller ones, one for each ip block.
#3 removes most of the irq-controller related register defines
and updates irq.c to get rid of au_readl/writel.
#4 converts IRQ PM to syscore_ops #5 converts DBDMA PM to syscore_ops #6 rewrite UART setup to use runtime CPU detection, and get
rid of most of the uart base address defines
#7 rewrite ethernet setup to use runtime CPU detection,
and get rid of most of the redundant ethernet constants
#8 updates the old au1000 dma driver: according to the
databooks physical addresses should be used for source and destination; this also allows then to remove another bunch of redundant address constants.
#9 changes the GPIO1/GPIO2 defines into offsets from their
respective ip block base. I also had to fixup the mtx-1 wdt driver a bit since it modified the gpio2 block directly.
All patches have been compile tested, and except for #7, #8 and the wdt parts of #9 also been run- and PM-tested on the DB1200.
CCing Florian and Wolfgang: If you have time, please test #7-#9 on your MTX-1 and GPR boards! I'd like to know whether ethernet and the mtx-1 watchdog still work! Thanks!
Please test/comment!
Thank you,
Manuel Lauss
Manuel Lauss (9):
MIPS: DB1200: Set Config[OD] for improved stability.
MIPS: Alchemy: update inlinable GPIO API
MIPS: Alchemy: irq code and constant cleanup
MIPS: Alchemy: convert irq.c to syscore_ops.
MIPS: Alchemy: convert dbdma.c to syscore_ops
MIPS: Alchemy: rewrite UART setup and constants.
MIPS: Alchemy: rewrite ethernet platform setup
MIPS: Alchemy: cleanup DMA addresses
MIPS: Alchemy: clean up GPIO registers and accessors
arch/mips/alchemy/common/dbdma.c | 123 +++----- arch/mips/alchemy/common/dma.c | 46 ++-- arch/mips/alchemy/common/irq.c | 345 +++++++++++----------- arch/mips/alchemy/common/platform.c | 250 ++++++++++------ arch/mips/alchemy/common/setup.c | 4 +- arch/mips/alchemy/devboards/db1200/setup.c | 7 + arch/mips/alchemy/devboards/pb1000/board_setup.c | 2 +- arch/mips/alchemy/devboards/pb1500/board_setup.c | 2 +- arch/mips/alchemy/devboards/prom.c | 2 +- arch/mips/alchemy/gpr/board_setup.c | 14 +- arch/mips/alchemy/gpr/init.c | 2 +- arch/mips/alchemy/mtx-1/board_setup.c | 2 +- arch/mips/alchemy/mtx-1/init.c | 2 +- arch/mips/alchemy/xxs1500/board_setup.c | 11 +- arch/mips/alchemy/xxs1500/init.c | 2 +- arch/mips/boot/compressed/uart-alchemy.c | 2 +- arch/mips/include/asm/mach-au1x00/au1000.h | 334 +++++---------------- arch/mips/include/asm/mach-au1x00/au1000_dma.h | 4 - arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h | 8 - arch/mips/include/asm/mach-au1x00/gpio-au1000.h | 122 +++++++-- drivers/watchdog/mtx-1_wdt.c | 21 +- 21 files changed, 615 insertions(+), 690 deletions(-)
Signature · 1 line
1.7.5.rc3
PATCH 1/9 MIPS: DB1200: Set Config[OD] for improved stability.
Setting Config[OD] gets rid of a _LOT_ of spurious CPLD interrupts, but also decreases overall performance a bit.
---
Resend of a patch I submitted earlier.
V2: fix up issues pointed out by Sergei Shtylyov.
arch/mips/alchemy/common/setup.c | 4 ++-- arch/mips/alchemy/devboards/db1200/setup.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
arch/mips/alchemy/common/setup.c +2 -2
@@ -52,8 +52,6 @@ void __init plat_mem_setup(void)/* this is faster than wasting cycles trying to approximate it */ preset_lpj = (est_freq >>1 ) /HZ ; -board_setup ();/* board specific setup */ -if (au1xxx_cpu_needs_config_od ())/* Various early Au1xx0 errata corrected by this */ set_c0_config (1 <<19 );/* Set Config[OD] */
@@ -61,6 +59,8 @@ void __init plat_mem_setup(void)/* Clear to obtain best system bus performance */ clear_c0_config (1 <<19 );/* Clear Config[OD] */ +board_setup ();/* board specific setup */ +/* IO/MEM resources. */ set_io_port_base (0 ); ioport_resource.start =IOPORT_RESOURCE_START ;
arch/mips/alchemy/devboards/db1200/setup.c +7 -0
@@ -23,6 +23,13 @@ void __init board_setup(void)unsigned long freq0, clksrc, div, pfc;unsigned short whoami; +/* Set Config[OD] (disable overlapping bus transaction): +* This gets rid of a _lot_ of spurious interrupts (especially +* wrt. IDE); but incurs ~10% performance hit in some +* cpu-bound applications. +*/ +set_c0_config (1 <<19 ); +bcsr_init (DB1200_BCSR_PHYS_ADDR ,DB1200_BCSR_PHYS_ADDR +DB1200_BCSR_HEXLED_OFS );
Signature · 1 line
1.7.5.rc3
Re: [PATCH 1/9] MIPS: DB1200: Set Config[OD] for improved stability.
Thanks, queued for 2.6.40.
Ralf
PATCH 2/9 MIPS: Alchemy: update inlinable GPIO API
In reply to Manuel LaussThis fixes a build failure with gpio_keys and CONFIG_GPIOLIB=n (mtx1):
CC drivers/input/keyboard/gpio_keys.ogpio_keys.c: In function 'gpio_keys_report_event':
gpio_keys.c:325:2: error: implicit declaration of function 'gpio_get_value_cansleep' gpio_keys.c: In function 'gpio_keys_setup_key':
gpio_keys.c:390:3: error: implicit declaration of function 'gpio_set_debounce'
Also add stubs for the other new functions.
---
Updated version of a patch I submitted a few times earlier.
arch/mips/include/asm/mach-au1x00/gpio-au1000.h | 51 +++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)
arch/mips/include/asm/mach-au1x00/gpio-au1000.h +51 -0
@@ -24,6 +24,7 @@#define MAKE_IRQ (intc, off) (AU1000_INTC##intc##_INT_BASE + (off)) +struct gpio ;static inline int au1000_gpio1_to_irq (int gpio) {
@@ -556,6 +557,16 @@ static inline void gpio_set_value(int gpio, int v)alchemy_gpio_set_value (gpio, v); } +static inline int gpio_get_value_cansleep (unsigned gpio) +{ +return gpio_get_value (gpio); +} + +static inline void gpio_set_value_cansleep (unsigned gpio,int value) +{ +gpio_set_value (gpio, value); +} +static inline int gpio_is_valid (int gpio) {return alchemy_gpio_is_valid (gpio);
@@ -581,10 +592,50 @@ static inline int gpio_request(unsigned gpio, const char *label)return 0 ; } +static inline int gpio_request_one (unsigned gpio, +unsigned long flags,const char *label) +{ +return 0 ; +} + +static inline int gpio_request_array (struct gpio *array,size_t num) +{ +return 0 ; +} +static inline void gpio_free (unsigned gpio) { } +static inline void gpio_free_array (struct gpio *array,size_t num) +{ +} + +static inline int gpio_set_debounce (unsigned gpio,unsigned debounce) +{ +return -ENOSYS ; +} + +static inline int gpio_export (unsigned gpio,bool direction_may_change) +{ +return -ENOSYS ; +} + +static inline int gpio_export_link (struct device *dev,const char *name, +unsigned gpio) +{ +return -ENOSYS ; +} + +static inline int gpio_sysfs_set_active_low (unsigned gpio,int value) +{ +return -ENOSYS ; +} + +static inline void gpio_unexport (unsigned gpio) +{ +} +#endif /* !CONFIG_ALCHEMY_GPIO_INDIRECT */
Signature · 1 line
1.7.5.rc3
Re: [PATCH 2/9] MIPS: Alchemy: update inlinable GPIO API
Thanks, queued for 2.6.40.
Ralf
PATCH 3/9 MIPS: Alchemy: irq code and constant cleanup
In reply to Manuel Laussreplace au_readl/au_writel with __raw_readl/__raw_writel, and clean up IC-related stuff from the headers.
--- arch/mips/alchemy/common/irq.c | 250 +++++++++++++++------------- arch/mips/include/asm/mach-au1x00/au1000.h | 121 +------------- 2 files changed, 140 insertions(+), 231 deletions(-)
arch/mips/alchemy/common/irq.c +135 -115
@@ -39,6 +39,36 @@#include <asm/mach-pb1x00/pb1000.h> #endif +/* Interrupt Controller register offsets */ +#define IC_CFG0RD 0x40 +#define IC_CFG0SET 0x40 +#define IC_CFG0CLR 0x44 +#define IC_CFG1RD 0x48 +#define IC_CFG1SET 0x48 +#define IC_CFG1CLR 0x4C +#define IC_CFG2RD 0x50 +#define IC_CFG2SET 0x50 +#define IC_CFG2CLR 0x54 +#define IC_REQ0INT 0x54 +#define IC_SRCRD 0x58 +#define IC_SRCSET 0x58 +#define IC_SRCCLR 0x5C +#define IC_REQ1INT 0x5C +#define IC_ASSIGNRD 0x60 +#define IC_ASSIGNSET 0x60 +#define IC_ASSIGNCLR 0x64 +#define IC_WAKERD 0x68 +#define IC_WAKESET 0x68 +#define IC_WAKECLR 0x6C +#define IC_MASKRD 0x70 +#define IC_MASKSET 0x70 +#define IC_MASKCLR 0x74 +#define IC_RISINGRD 0x78 +#define IC_RISINGCLR 0x78 +#define IC_FALLINGRD 0x7C +#define IC_FALLINGCLR 0x7C +#define IC_TESTBIT 0x80 +static int au1x_ic_settype (struct irq_data *d,unsigned int flow_type);/* NOTE on interrupt priorities: The original writers of this code said:
@@ -221,89 +251,101 @@ struct au1xxx_irqmap au1200_irqmap[] __initdata = {static void au1x_ic0_unmask (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC0_INT_BASE ; -au_writel (1 << bit,IC0_MASKSET ); -au_writel (1 << bit,IC0_WAKESET ); -au_sync (); +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ); + +__raw_writel (1 << bit, base +IC_MASKSET ); +__raw_writel (1 << bit, base +IC_WAKESET ); +wmb (); }static void au1x_ic1_unmask (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC1_INT_BASE ; -au_writel (1 << bit,IC1_MASKSET ); -au_writel (1 << bit,IC1_WAKESET ); +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ); + +__raw_writel (1 << bit, base +IC_MASKSET ); +__raw_writel (1 << bit, base +IC_WAKESET );/* very hacky. does the pb1000 cpld auto-disable this int? * nowhere in the current kernel sources is it disabled. --mlau */ #if defined(CONFIG_MIPS_PB1000 )if (d->irq ==AU1000_GPIO15_INT ) -au_writel (0x4000 ,PB1000_MDR );/* enable int */ +__raw_writel (0x4000 , (void __iomem *)PB1000_MDR );/* enable int */ #endif -au_sync (); +wmb (); }static void au1x_ic0_mask (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC0_INT_BASE ; -au_writel (1 << bit,IC0_MASKCLR ); -au_writel (1 << bit,IC0_WAKECLR ); -au_sync (); +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ); + +__raw_writel (1 << bit, base +IC_MASKCLR ); +__raw_writel (1 << bit, base +IC_WAKECLR ); +wmb (); }static void au1x_ic1_mask (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC1_INT_BASE ; -au_writel (1 << bit,IC1_MASKCLR ); -au_writel (1 << bit,IC1_WAKECLR ); -au_sync (); +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ); + +__raw_writel (1 << bit, base +IC_MASKCLR ); +__raw_writel (1 << bit, base +IC_WAKECLR ); +wmb (); }static void au1x_ic0_ack (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC0_INT_BASE ; +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR );/* * This may assume that we don't get interrupts from * both edges at once, or if we do, that we don't care. */ -au_writel (1 << bit,IC0_FALLINGCLR ); -au_writel (1 << bit,IC0_RISINGCLR ); -au_sync (); +__raw_writel (1 << bit, base +IC_FALLINGCLR ); +__raw_writel (1 << bit, base +IC_RISINGCLR ); +wmb (); }static void au1x_ic1_ack (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC1_INT_BASE ; +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR );/* * This may assume that we don't get interrupts from * both edges at once, or if we do, that we don't care. */ -au_writel (1 << bit,IC1_FALLINGCLR ); -au_writel (1 << bit,IC1_RISINGCLR ); -au_sync (); +__raw_writel (1 << bit, base +IC_FALLINGCLR ); +__raw_writel (1 << bit, base +IC_RISINGCLR ); +wmb (); }static void au1x_ic0_maskack (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC0_INT_BASE ; +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ); -au_writel (1 << bit,IC0_WAKECLR ); -au_writel (1 << bit,IC0_MASKCLR ); -au_writel (1 << bit,IC0_RISINGCLR ); -au_writel (1 << bit,IC0_FALLINGCLR ); -au_sync (); +__raw_writel (1 << bit, base +IC_WAKECLR ); +__raw_writel (1 << bit, base +IC_MASKCLR ); +__raw_writel (1 << bit, base +IC_RISINGCLR ); +__raw_writel (1 << bit, base +IC_FALLINGCLR ); +wmb (); }static void au1x_ic1_maskack (struct irq_data *d) {unsigned int bit = d->irq -AU1000_INTC1_INT_BASE ; +void __iomem *base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ); -au_writel (1 << bit,IC1_WAKECLR ); -au_writel (1 << bit,IC1_MASKCLR ); -au_writel (1 << bit,IC1_RISINGCLR ); -au_writel (1 << bit,IC1_FALLINGCLR ); -au_sync (); +__raw_writel (1 << bit, base +IC_WAKECLR ); +__raw_writel (1 << bit, base +IC_MASKCLR ); +__raw_writel (1 << bit, base +IC_RISINGCLR ); +__raw_writel (1 << bit, base +IC_FALLINGCLR ); +wmb (); }static int au1x_ic1_setwake (struct irq_data *d,unsigned int on)
@@ -318,13 +360,13 @@ static int au1x_ic1_setwake(struct irq_data *d, unsigned int on)return -EINVAL ;local_irq_save (flags); - wakemsk =au_readl (SYS_WAKEMSK ); + wakemsk =__raw_readl ((void __iomem *)SYS_WAKEMSK );if (on) wakemsk |=1 << bit;else wakemsk &= ~(1 << bit); -au_writel (wakemsk,SYS_WAKEMSK ); -au_sync (); +__raw_writel (wakemsk, (void __iomem *)SYS_WAKEMSK ); +wmb ();local_irq_restore (flags);return 0 ;
@@ -356,81 +398,74 @@ static struct irq_chip au1x_ic1_chip = {static int au1x_ic_settype (struct irq_data *d,unsigned int flow_type) {struct irq_chip *chip; -unsigned long icr[6 ]; -unsigned int bit, ic, irq = d->irq; +unsigned int bit, irq = d->irq;irq_flow_handler_t handler =NULL ;unsigned char *name =NULL ; +void __iomem *base;int ret;if (irq >=AU1000_INTC1_INT_BASE ) { bit = irq -AU1000_INTC1_INT_BASE ; chip = &au1x_ic1_chip; - ic =1 ; + base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ); }else { bit = irq -AU1000_INTC0_INT_BASE ; chip = &au1x_ic0_chip; - ic =0 ; + base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ); }if (bit >31 )return -EINVAL ; - icr[0 ] = ic ?IC1_CFG0SET :IC0_CFG0SET ; - icr[1 ] = ic ?IC1_CFG1SET :IC0_CFG1SET ; - icr[2 ] = ic ?IC1_CFG2SET :IC0_CFG2SET ; - icr[3 ] = ic ?IC1_CFG0CLR :IC0_CFG0CLR ; - icr[4 ] = ic ?IC1_CFG1CLR :IC0_CFG1CLR ; - icr[5 ] = ic ?IC1_CFG2CLR :IC0_CFG2CLR ; - ret =0 ;switch (flow_type) {/* cfgregs 2:1:0 */ case IRQ_TYPE_EDGE_RISING :/* 0:0:1 */ -au_writel (1 << bit, icr[5 ]); -au_writel (1 << bit, icr[4 ]); -au_writel (1 << bit, icr[0 ]); +__raw_writel (1 << bit, base +IC_CFG2CLR ); +__raw_writel (1 << bit, base +IC_CFG1CLR ); +__raw_writel (1 << bit, base +IC_CFG0SET ); handler = handle_edge_irq; name ="riseedge" ;break ;case IRQ_TYPE_EDGE_FALLING :/* 0:1:0 */ -au_writel (1 << bit, icr[5 ]); -au_writel (1 << bit, icr[1 ]); -au_writel (1 << bit, icr[3 ]); +__raw_writel (1 << bit, base +IC_CFG2CLR ); +__raw_writel (1 << bit, base +IC_CFG1SET ); +__raw_writel (1 << bit, base +IC_CFG0CLR ); handler = handle_edge_irq; name ="falledge" ;break ;case IRQ_TYPE_EDGE_BOTH :/* 0:1:1 */ -au_writel (1 << bit, icr[5 ]); -au_writel (1 << bit, icr[1 ]); -au_writel (1 << bit, icr[0 ]); +__raw_writel (1 << bit, base +IC_CFG2CLR ); +__raw_writel (1 << bit, base +IC_CFG1SET ); +__raw_writel (1 << bit, base +IC_CFG0SET ); handler = handle_edge_irq; name ="bothedge" ;break ;case IRQ_TYPE_LEVEL_HIGH :/* 1:0:1 */ -au_writel (1 << bit, icr[2 ]); -au_writel (1 << bit, icr[4 ]); -au_writel (1 << bit, icr[0 ]); +__raw_writel (1 << bit, base +IC_CFG2SET ); +__raw_writel (1 << bit, base +IC_CFG1CLR ); +__raw_writel (1 << bit, base +IC_CFG0SET ); handler = handle_level_irq; name ="hilevel" ;break ;case IRQ_TYPE_LEVEL_LOW :/* 1:1:0 */ -au_writel (1 << bit, icr[2 ]); -au_writel (1 << bit, icr[1 ]); -au_writel (1 << bit, icr[3 ]); +__raw_writel (1 << bit, base +IC_CFG2SET ); +__raw_writel (1 << bit, base +IC_CFG1SET ); +__raw_writel (1 << bit, base +IC_CFG0CLR ); handler = handle_level_irq; name ="lowlevel" ;break ;case IRQ_TYPE_NONE :/* 0:0:0 */ -au_writel (1 << bit, icr[5 ]); -au_writel (1 << bit, icr[4 ]); -au_writel (1 << bit, icr[3 ]); +__raw_writel (1 << bit, base +IC_CFG2CLR ); +__raw_writel (1 << bit, base +IC_CFG1CLR ); +__raw_writel (1 << bit, base +IC_CFG0CLR );break ;default : ret = -EINVAL ; }__irq_set_chip_handler_name_locked (d->irq, chip, handler, name); -au_sync (); +wmb ();return ret; }
@@ -444,21 +479,21 @@ asmlinkage void plat_irq_dispatch(void) off =MIPS_CPU_IRQ_BASE +7 ; goto handle; }else if (pending &CAUSEF_IP2 ) { - s =IC0_REQ0INT ; + s =KSEG1ADDR (AU1000_IC0_PHYS_ADDR ) +IC_REQ0INT ; off =AU1000_INTC0_INT_BASE ; }else if (pending &CAUSEF_IP3 ) { - s =IC0_REQ1INT ; + s =KSEG1ADDR (AU1000_IC0_PHYS_ADDR ) +IC_REQ1INT ; off =AU1000_INTC0_INT_BASE ; }else if (pending &CAUSEF_IP4 ) { - s =IC1_REQ0INT ; + s =KSEG1ADDR (AU1000_IC1_PHYS_ADDR ) +IC_REQ0INT ; off =AU1000_INTC1_INT_BASE ; }else if (pending &CAUSEF_IP5 ) { - s =IC1_REQ1INT ; + s =KSEG1ADDR (AU1000_IC1_PHYS_ADDR ) +IC_REQ1INT ; off =AU1000_INTC1_INT_BASE ; }else goto spurious; - s =au_readl (s); + s =__raw_readl ((void __iomem *)s);if (unlikely (!s)) { spurious:spurious_interrupt ();
@@ -469,48 +504,42 @@ handle:do_IRQ (off); } + +static inline void ic_init (void __iomem *base) +{ +/* initialize interrupt controller to a safe state */ +__raw_writel (0xffffffff , base +IC_CFG0CLR ); +__raw_writel (0xffffffff , base +IC_CFG1CLR ); +__raw_writel (0xffffffff , base +IC_CFG2CLR ); +__raw_writel (0xffffffff , base +IC_MASKCLR ); +__raw_writel (0xffffffff , base +IC_ASSIGNCLR ); +__raw_writel (0xffffffff , base +IC_WAKECLR ); +__raw_writel (0xffffffff , base +IC_SRCSET ); +__raw_writel (0xffffffff , base +IC_FALLINGCLR ); +__raw_writel (0xffffffff , base +IC_RISINGCLR ); +__raw_writel (0x00000000 , base +IC_TESTBIT ); +wmb (); +} +static void __init au1000_init_irq (struct au1xxx_irqmap *map) {unsigned int bit, irq_nr; -int i; - -/* -* Initialize interrupt controllers to a safe state. -*/ -au_writel (0xffffffff ,IC0_CFG0CLR ); -au_writel (0xffffffff ,IC0_CFG1CLR ); -au_writel (0xffffffff ,IC0_CFG2CLR ); -au_writel (0xffffffff ,IC0_MASKCLR ); -au_writel (0xffffffff ,IC0_ASSIGNCLR ); -au_writel (0xffffffff ,IC0_WAKECLR ); -au_writel (0xffffffff ,IC0_SRCSET ); -au_writel (0xffffffff ,IC0_FALLINGCLR ); -au_writel (0xffffffff ,IC0_RISINGCLR ); -au_writel (0x00000000 ,IC0_TESTBIT ); - -au_writel (0xffffffff ,IC1_CFG0CLR ); -au_writel (0xffffffff ,IC1_CFG1CLR ); -au_writel (0xffffffff ,IC1_CFG2CLR ); -au_writel (0xffffffff ,IC1_MASKCLR ); -au_writel (0xffffffff ,IC1_ASSIGNCLR ); -au_writel (0xffffffff ,IC1_WAKECLR ); -au_writel (0xffffffff ,IC1_SRCSET ); -au_writel (0xffffffff ,IC1_FALLINGCLR ); -au_writel (0xffffffff ,IC1_RISINGCLR ); -au_writel (0x00000000 ,IC1_TESTBIT ); +void __iomem *base; +ic_init ((void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR )); +ic_init ((void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ));mips_cpu_irq_init ();/* register all 64 possible IC0+IC1 irq sources as type "none". * Use set_irq_type() to set edge/level behaviour at runtime. */ -for (i =AU1000_INTC0_INT_BASE ; - (i <AU1000_INTC0_INT_BASE +32 ); i++) -au1x_ic_settype (irq_get_irq_data (i),IRQ_TYPE_NONE ); +for (irq_nr =AU1000_INTC0_INT_BASE ; + (irq_nr <AU1000_INTC0_INT_BASE +32 ); irq_nr++) +au1x_ic_settype (irq_get_irq_data (irq_nr),IRQ_TYPE_NONE ); -for (i =AU1000_INTC1_INT_BASE ; - (i <AU1000_INTC1_INT_BASE +32 ); i++) -au1x_ic_settype (irq_get_irq_data (i),IRQ_TYPE_NONE ); +for (irq_nr =AU1000_INTC1_INT_BASE ; + (irq_nr <AU1000_INTC1_INT_BASE +32 ); irq_nr++) +au1x_ic_settype (irq_get_irq_data (irq_nr),IRQ_TYPE_NONE );/* * Initialize IC0, which is fixed per processor.
@@ -520,13 +549,13 @@ static void __init au1000_init_irq(struct au1xxx_irqmap *map)if (irq_nr >=AU1000_INTC1_INT_BASE ) { bit = irq_nr -AU1000_INTC1_INT_BASE ; -if (map->im_request) -au_writel (1 << bit,IC1_ASSIGNSET ); + base = (void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ); }else { bit = irq_nr -AU1000_INTC0_INT_BASE ; -if (map->im_request) -au_writel (1 << bit,IC0_ASSIGNSET ); + base = (void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ); } +if (map->im_request) +__raw_writel (1 << bit, base +IC_ASSIGNSET );au1x_ic_settype (irq_get_irq_data (irq_nr), map->im_type); ++map;
@@ -583,17 +612,8 @@ static int alchemy_ic_resume(struct sys_device *dev)struct alchemy_ic_sysdev *icdev = container_of(dev, struct alchemy_ic_sysdev, sysdev); -__raw_writel (0xffffffff , icdev->base +IC_MASKCLR ); -__raw_writel (0xffffffff , icdev->base +IC_CFG0CLR ); -__raw_writel (0xffffffff , icdev->base +IC_CFG1CLR ); -__raw_writel (0xffffffff , icdev->base +IC_CFG2CLR ); -__raw_writel (0xffffffff , icdev->base +IC_SRCCLR ); -__raw_writel (0xffffffff , icdev->base +IC_ASSIGNCLR ); -__raw_writel (0xffffffff , icdev->base +IC_WAKECLR ); -__raw_writel (0xffffffff , icdev->base +IC_RISINGCLR ); -__raw_writel (0xffffffff , icdev->base +IC_FALLINGCLR ); -__raw_writel (0x00000000 , icdev->base +IC_TESTBIT ); -wmb (); +ic_init (icdev->base); +__raw_writel (icdev->pmdata[0 ], icdev->base +IC_CFG0SET );__raw_writel (icdev->pmdata[1 ], icdev->base +IC_CFG1SET );__raw_writel (icdev->pmdata[2 ], icdev->base +IC_CFG2SET );
@@ -617,7 +637,7 @@ static struct sysdev_class alchemy_ic_sysdev_class = {static int __init alchemy_ic_sysdev_init (void ) {struct alchemy_ic_sysdev *icdev; -unsigned long icbase[2 ] = {IC0_PHYS_ADDR ,IC1_PHYS_ADDR }; +unsigned long icbase[2 ] = {AU1000_IC0_PHYS_ADDR ,AU1000_IC1_PHYS_ADDR };int err, i; err =sysdev_class_register (&alchemy_ic_sysdev_class);
arch/mips/include/asm/mach-au1x00/au1000.h +5 -116
167 lines not on this page · raw message
Signature · 1 line
1.7.5.rc3
Re: [PATCH 3/9] MIPS: Alchemy: irq code and constant cleanup
Thanks, queued for 2.6.40.
Ralf
PATCH 4/9 MIPS: Alchemy: convert irq.c to syscore_ops.
In reply to Manuel Laussconvert the PM sysdev to use syscore_ops instead.
--- arch/mips/alchemy/common/irq.c | 101 ++++++++++++++++------------------------ 1 files changed, 41 insertions(+), 60 deletions(-)
arch/mips/alchemy/common/irq.c +41 -60
@@ -30,7 +30,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h>
@@ -585,81 +585,62 @@ void __init arch_init_irq(void) } } -struct alchemy_ic_sysdev { -struct sys_device sysdev; -void __iomem *base; -unsigned long pmdata[7 ]; -}; - -static int alchemy_ic_suspend (struct sys_device *dev,pm_message_t state) -{ -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); - icdev->pmdata[0 ] =__raw_readl (icdev->base +IC_CFG0RD ); - icdev->pmdata[1 ] =__raw_readl (icdev->base +IC_CFG1RD ); - icdev->pmdata[2 ] =__raw_readl (icdev->base +IC_CFG2RD ); - icdev->pmdata[3 ] =__raw_readl (icdev->base +IC_SRCRD ); - icdev->pmdata[4 ] =__raw_readl (icdev->base +IC_ASSIGNRD ); - icdev->pmdata[5 ] =__raw_readl (icdev->base +IC_WAKERD ); - icdev->pmdata[6 ] =__raw_readl (icdev->base +IC_MASKRD ); +static unsigned long alchemy_ic_pmdata[7 *2 ]; -return 0 ; +static inline void alchemy_ic_suspend_one (void __iomem *base,unsigned long *d) +{ + d[0 ] =__raw_readl (base +IC_CFG0RD ); + d[1 ] =__raw_readl (base +IC_CFG1RD ); + d[2 ] =__raw_readl (base +IC_CFG2RD ); + d[3 ] =__raw_readl (base +IC_SRCRD ); + d[4 ] =__raw_readl (base +IC_ASSIGNRD ); + d[5 ] =__raw_readl (base +IC_WAKERD ); + d[6 ] =__raw_readl (base +IC_MASKRD ); +ic_init (base);/* shut it up too while at it */ } -static int alchemy_ic_resume (struct sys_device *dev) +static inline void alchemy_ic_resume_one (void __iomem *base,unsigned long *d) { -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); - -ic_init (icdev->base); - -__raw_writel (icdev->pmdata[0 ], icdev->base +IC_CFG0SET ); -__raw_writel (icdev->pmdata[1 ], icdev->base +IC_CFG1SET ); -__raw_writel (icdev->pmdata[2 ], icdev->base +IC_CFG2SET ); -__raw_writel (icdev->pmdata[3 ], icdev->base +IC_SRCSET ); -__raw_writel (icdev->pmdata[4 ], icdev->base +IC_ASSIGNSET ); -__raw_writel (icdev->pmdata[5 ], icdev->base +IC_WAKESET ); +ic_init (base); + +__raw_writel (d[0 ], base +IC_CFG0SET ); +__raw_writel (d[1 ], base +IC_CFG1SET ); +__raw_writel (d[2 ], base +IC_CFG2SET ); +__raw_writel (d[3 ], base +IC_SRCSET ); +__raw_writel (d[4 ], base +IC_ASSIGNSET ); +__raw_writel (d[5 ], base +IC_WAKESET );wmb (); -__raw_writel (icdev->pmdata[6 ], icdev->base +IC_MASKSET ); +__raw_writel (d[6 ], base +IC_MASKSET );wmb (); +} +static int alchemy_ic_suspend (void ) +{ +alchemy_ic_suspend_one ((void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ), + alchemy_ic_pmdata); +alchemy_ic_suspend_one ((void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ), + &alchemy_ic_pmdata[7 ]);return 0 ; } -static struct sysdev_class alchemy_ic_sysdev_class = { - .name ="ic" , +static void alchemy_ic_resume (void ) +{ +alchemy_ic_resume_one ((void __iomem *)KSEG1ADDR (AU1000_IC1_PHYS_ADDR ), + &alchemy_ic_pmdata[7 ]); +alchemy_ic_resume_one ((void __iomem *)KSEG1ADDR (AU1000_IC0_PHYS_ADDR ), + alchemy_ic_pmdata); +} + +static struct syscore_ops alchemy_ic_syscore_ops = { .suspend = alchemy_ic_suspend, .resume = alchemy_ic_resume, }; -static int __init alchemy_ic_sysdev_init (void ) +static int __init alchemy_ic_pm_init (void ) { -struct alchemy_ic_sysdev *icdev; -unsigned long icbase[2 ] = {AU1000_IC0_PHYS_ADDR ,AU1000_IC1_PHYS_ADDR }; -int err, i; - - err =sysdev_class_register (&alchemy_ic_sysdev_class); -if (err) -return err; - -for (i =0 ; i <2 ; i++) { - icdev =kzalloc (sizeof (struct alchemy_ic_sysdev ),GFP_KERNEL ); -if (!icdev) -return -ENOMEM ; - - icdev->base =ioremap (icbase[i],0x1000 ); - - icdev->sysdev.id = i; - icdev->sysdev.cls = &alchemy_ic_sysdev_class; - err =sysdev_register (&icdev->sysdev); -if (err) { -kfree (icdev); -return err; - } - } - +register_syscore_ops (&alchemy_ic_syscore_ops);return 0 ; } -device_initcall (alchemy_ic_sysdev_init); +device_initcall (alchemy_ic_pm_init);
Signature · 1 line
1.7.5.rc3
Re: [PATCH 4/9] MIPS: Alchemy: convert irq.c to syscore_ops.
Thanks, queued for 2.6.40.
Ralf
PATCH 5/9 MIPS: Alchemy: convert dbdma.c to syscore_ops
In reply to Manuel Laussconvert the PM sysdev to syscore_ops and clean up the ddma addresses a bit.
--- arch/mips/alchemy/common/dbdma.c | 123 ++++++++-------------- arch/mips/include/asm/mach-au1x00/au1000.h | 4 +- arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h | 8 -- 3 files changed, 47 insertions(+), 88 deletions(-)
arch/mips/alchemy/common/dbdma.c +45 -78
@@ -36,7 +36,7 @@#include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/module.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/mach-au1x00/au1000.h> #include <asm/mach-au1x00/au1xxx_dbdma.h>
@@ -58,7 +58,8 @@ static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);/* I couldn't find a macro that did this... */ #define ALIGN_ADDR (x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) -static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE ; +static dbdma_global_t *dbdma_gptr = + (dbdma_global_t *)KSEG1ADDR (AU1550_DBDMA_CONF_PHYS_ADDR );static int dbdma_initialized;static dbdev_tab_t dbdev_tab[] = {
@@ -299,7 +300,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,if (ctp !=NULL ) {memset (ctp,0 ,sizeof (chan_tab_t)); ctp->chan_index = chan = i; - dcp =DDMA_CHANNEL_BASE ; + dcp =KSEG1ADDR (AU1550_DBDMA_PHYS_ADDR ); dcp += (0x0100 * chan); ctp->chan_ptr = (au1x_dma_chan_t *)dcp; cp = (au1x_dma_chan_t *)dcp;
@@ -958,105 +959,75 @@ u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr) } -struct alchemy_dbdma_sysdev { -struct sys_device sysdev; -u32 pm_regs[NUM_DBDMA_CHANS +1 ][6 ]; -}; +static unsigned long alchemy_dbdma_pm_data[NUM_DBDMA_CHANS +1 ][6 ]; -static int alchemy_dbdma_suspend (struct sys_device *dev, -pm_message_t state) +static int alchemy_dbdma_suspend (void ) { -struct alchemy_dbdma_sysdev *sdev = - container_of(dev, struct alchemy_dbdma_sysdev, sysdev);int i; -u32 addr; +void __iomem *addr; - addr =DDMA_GLOBAL_BASE ; - sdev->pm_regs[0 ][0 ] =au_readl (addr +0x00 ); - sdev->pm_regs[0 ][1 ] =au_readl (addr +0x04 ); - sdev->pm_regs[0 ][2 ] =au_readl (addr +0x08 ); - sdev->pm_regs[0 ][3 ] =au_readl (addr +0x0c ); + addr = (void __iomem *)KSEG1ADDR (AU1550_DBDMA_CONF_PHYS_ADDR ); + alchemy_dbdma_pm_data[0 ][0 ] =__raw_readl (addr +0x00 ); + alchemy_dbdma_pm_data[0 ][1 ] =__raw_readl (addr +0x04 ); + alchemy_dbdma_pm_data[0 ][2 ] =__raw_readl (addr +0x08 ); + alchemy_dbdma_pm_data[0 ][3 ] =__raw_readl (addr +0x0c );/* save channel configurations */ -for (i =1 , addr =DDMA_CHANNEL_BASE ; i <=NUM_DBDMA_CHANS ; i++) { - sdev->pm_regs[i][0 ] =au_readl (addr +0x00 ); - sdev->pm_regs[i][1 ] =au_readl (addr +0x04 ); - sdev->pm_regs[i][2 ] =au_readl (addr +0x08 ); - sdev->pm_regs[i][3 ] =au_readl (addr +0x0c ); - sdev->pm_regs[i][4 ] =au_readl (addr +0x10 ); - sdev->pm_regs[i][5 ] =au_readl (addr +0x14 ); + addr = (void __iomem *)KSEG1ADDR (AU1550_DBDMA_PHYS_ADDR ); +for (i =1 ; i <=NUM_DBDMA_CHANS ; i++) { + alchemy_dbdma_pm_data[i][0 ] =__raw_readl (addr +0x00 ); + alchemy_dbdma_pm_data[i][1 ] =__raw_readl (addr +0x04 ); + alchemy_dbdma_pm_data[i][2 ] =__raw_readl (addr +0x08 ); + alchemy_dbdma_pm_data[i][3 ] =__raw_readl (addr +0x0c ); + alchemy_dbdma_pm_data[i][4 ] =__raw_readl (addr +0x10 ); + alchemy_dbdma_pm_data[i][5 ] =__raw_readl (addr +0x14 );/* halt channel */ -au_writel (sdev->pm_regs[i][0 ] & ~1 , addr +0x00 ); -au_sync (); -while (!(au_readl (addr +0x14 ) &1 )) -au_sync (); +__raw_writel (alchemy_dbdma_pm_data[i][0 ] & ~1 , addr +0x00 ); +wmb (); +while (!(__raw_readl (addr +0x14 ) &1 )) +wmb (); addr +=0x100 ;/* next channel base */ }/* disable channel interrupts */ -au_writel (0 ,DDMA_GLOBAL_BASE +0x0c ); -au_sync (); + addr = (void __iomem *)KSEG1ADDR (AU1550_DBDMA_CONF_PHYS_ADDR ); +__raw_writel (0 , addr +0x0c ); +wmb ();return 0 ; } -static int alchemy_dbdma_resume (struct sys_device *dev) +static void alchemy_dbdma_resume (void ) { -struct alchemy_dbdma_sysdev *sdev = - container_of(dev, struct alchemy_dbdma_sysdev, sysdev);int i; -u32 addr; +void __iomem *addr; - addr =DDMA_GLOBAL_BASE ; -au_writel (sdev->pm_regs[0 ][0 ], addr +0x00 ); -au_writel (sdev->pm_regs[0 ][1 ], addr +0x04 ); -au_writel (sdev->pm_regs[0 ][2 ], addr +0x08 ); -au_writel (sdev->pm_regs[0 ][3 ], addr +0x0c ); + addr = (void __iomem *)KSEG1ADDR (AU1550_DBDMA_CONF_PHYS_ADDR ); +__raw_writel (alchemy_dbdma_pm_data[0 ][0 ], addr +0x00 ); +__raw_writel (alchemy_dbdma_pm_data[0 ][1 ], addr +0x04 ); +__raw_writel (alchemy_dbdma_pm_data[0 ][2 ], addr +0x08 ); +__raw_writel (alchemy_dbdma_pm_data[0 ][3 ], addr +0x0c );/* restore channel configurations */ -for (i =1 , addr =DDMA_CHANNEL_BASE ; i <=NUM_DBDMA_CHANS ; i++) { -au_writel (sdev->pm_regs[i][0 ], addr +0x00 ); -au_writel (sdev->pm_regs[i][1 ], addr +0x04 ); -au_writel (sdev->pm_regs[i][2 ], addr +0x08 ); -au_writel (sdev->pm_regs[i][3 ], addr +0x0c ); -au_writel (sdev->pm_regs[i][4 ], addr +0x10 ); -au_writel (sdev->pm_regs[i][5 ], addr +0x14 ); -au_sync (); + addr = (void __iomem *)KSEG1ADDR (AU1550_DBDMA_PHYS_ADDR ); +for (i =1 ; i <=NUM_DBDMA_CHANS ; i++) { +__raw_writel (alchemy_dbdma_pm_data[i][0 ], addr +0x00 ); +__raw_writel (alchemy_dbdma_pm_data[i][1 ], addr +0x04 ); +__raw_writel (alchemy_dbdma_pm_data[i][2 ], addr +0x08 ); +__raw_writel (alchemy_dbdma_pm_data[i][3 ], addr +0x0c ); +__raw_writel (alchemy_dbdma_pm_data[i][4 ], addr +0x10 ); +__raw_writel (alchemy_dbdma_pm_data[i][5 ], addr +0x14 ); +wmb (); addr +=0x100 ;/* next channel base */ } - -return 0 ; } -static struct sysdev_class alchemy_dbdma_sysdev_class = { - .name ="dbdma" , +static struct syscore_ops alchemy_dbdma_syscore_ops = { .suspend = alchemy_dbdma_suspend, .resume = alchemy_dbdma_resume, }; -static int __init alchemy_dbdma_sysdev_init (void ) -{ -struct alchemy_dbdma_sysdev *sdev; -int ret; - - ret =sysdev_class_register (&alchemy_dbdma_sysdev_class); -if (ret) -return ret; - - sdev =kzalloc (sizeof (struct alchemy_dbdma_sysdev ),GFP_KERNEL ); -if (!sdev) -return -ENOMEM ; - - sdev->sysdev.id =-1 ; - sdev->sysdev.cls = &alchemy_dbdma_sysdev_class; - ret =sysdev_register (&sdev->sysdev); -if (ret) -kfree (sdev); - -return ret; -} -static int __init au1xxx_dbdma_init (void ) {int irq_nr, ret;
@@ -1084,11 +1055,7 @@ static int __init au1xxx_dbdma_init(void)else { dbdma_initialized =1 ;printk (KERN_INFO "Alchemy DBDMA initialized\n" ); - ret =alchemy_dbdma_sysdev_init (); -if (ret) { -printk (KERN_ERR "DBDMA PM init failed\n" ); - ret =0 ; - } +register_syscore_ops (&alchemy_dbdma_syscore_ops); }return ret;
arch/mips/include/asm/mach-au1x00/au1000.h +2 -2
@@ -635,6 +635,8 @@ enum soc_au1200_ints {#define AU1000_IC0_PHYS_ADDR 0x10400000/* 01234 */ #define AU1000_IC1_PHYS_ADDR 0x11800000/* 01234 */ +#define AU1550_DBDMA_PHYS_ADDR 0x14002000/* 34 */ +#define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000/* 34 */ #ifdef CONFIG_SOC_AU1000
@@ -761,7 +763,6 @@ enum soc_au1200_ints {#define UART3_PHYS_ADDR 0x11400000#define GPIO2_PHYS_ADDR 0x11700000#define SYS_PHYS_ADDR 0x11900000 -#define DDMA_PHYS_ADDR 0x14002000#define PE_PHYS_ADDR 0x14008000#define PSC0_PHYS_ADDR 0x11A00000#define PSC1_PHYS_ADDR 0x11B00000
@@ -789,7 +790,6 @@ enum soc_au1200_ints {#define UART1_PHYS_ADDR 0x11200000#define GPIO2_PHYS_ADDR 0x11700000#define SYS_PHYS_ADDR 0x11900000 -#define DDMA_PHYS_ADDR 0x14002000#define PSC0_PHYS_ADDR 0x11A00000#define PSC1_PHYS_ADDR 0x11B00000#define SD0_PHYS_ADDR 0x10600000
arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h +0 -8
@@ -37,14 +37,6 @@ #ifndef _LANGUAGE_ASSEMBLY -/* - * The DMA base addresses. - * The channels are every 256 bytes (0x0100) from the channel 0 base. - * Interrupt status/enable is bits 15:0 for channels 15 to zero. - */ -#define DDMA_GLOBAL_BASE 0xb4003000 -#define DDMA_CHANNEL_BASE 0xb4002000 - typedef volatile struct dbdma_global { u32 ddma_config; u32 ddma_intstat;
Signature · 1 line
1.7.5.rc3
Re: [PATCH 5/9] MIPS: Alchemy: convert dbdma.c to syscore_ops
Thanks, queued for 2.6.40,
Ralf
PATCH 6/9 MIPS: Alchemy: rewrite UART setup and constants.
In reply to Manuel LaussDetect CPU type at runtime and setup uarts accordingly; also clean up the uart base address mess in the process as far as possible.
--- arch/mips/alchemy/common/platform.c | 93 +++++++++++++++------------- arch/mips/alchemy/devboards/prom.c | 2 +- arch/mips/alchemy/gpr/board_setup.c | 14 +--- arch/mips/alchemy/gpr/init.c | 2 +- arch/mips/alchemy/mtx-1/init.c | 2 +- arch/mips/alchemy/xxs1500/board_setup.c | 11 +-- arch/mips/alchemy/xxs1500/init.c | 2 +- arch/mips/boot/compressed/uart-alchemy.c | 2 +- arch/mips/include/asm/mach-au1x00/au1000.h | 57 +++++++++++++---- 9 files changed, 107 insertions(+), 78 deletions(-)
arch/mips/alchemy/common/platform.c +51 -42
@@ -30,21 +30,12 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state,#ifdef CONFIG_SERIAL_8250 switch (state) {case 0 : -if ((__raw_readl (port->membase +UART_MOD_CNTRL ) &3 ) !=3 ) { -/* power-on sequence as suggested in the databooks */ -__raw_writel (0 , port->membase +UART_MOD_CNTRL ); -wmb (); -__raw_writel (1 , port->membase +UART_MOD_CNTRL ); -wmb (); - } -__raw_writel (3 , port->membase +UART_MOD_CNTRL );/* full on */ -wmb (); +alchemy_uart_enable (CPHYSADDR (port->membase));serial8250_do_pm (port, state, old_state);break ;case 3 :/* power off */ serial8250_do_pm (port, state, old_state); -__raw_writel (0 , port->membase +UART_MOD_CNTRL ); -wmb (); +alchemy_uart_disable (CPHYSADDR (port->membase));break ;default :serial8250_do_pm (port, state, old_state);
@@ -65,38 +56,60 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state, .pm = alchemy_8250_pm, \ } -static struct plat_serial8250_port au1x00_uart_data[] = { -#if defined(CONFIG_SOC_AU1000) - PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), - PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), - PORT(UART2_PHYS_ADDR, AU1000_UART2_INT), - PORT(UART3_PHYS_ADDR, AU1000_UART3_INT), -#elif defined(CONFIG_SOC_AU1500) - PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), - PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), -#elif defined(CONFIG_SOC_AU1100) - PORT(UART0_PHYS_ADDR, AU1100_UART0_INT), - PORT(UART1_PHYS_ADDR, AU1100_UART1_INT), - PORT(UART3_PHYS_ADDR, AU1100_UART3_INT), -#elif defined(CONFIG_SOC_AU1550) - PORT(UART0_PHYS_ADDR, AU1550_UART0_INT), - PORT(UART1_PHYS_ADDR, AU1550_UART1_INT), - PORT(UART3_PHYS_ADDR, AU1550_UART3_INT), -#elif defined(CONFIG_SOC_AU1200) - PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), - PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), -#endif - { }, +static struct plat_serial8250_port au1x00_uart_data[][4 ]__initdata = { + [ALCHEMY_CPU_AU1000 ] = { +PORT (AU1000_UART0_PHYS_ADDR ,AU1000_UART0_INT ), +PORT (AU1000_UART1_PHYS_ADDR ,AU1000_UART1_INT ), +PORT (AU1000_UART2_PHYS_ADDR ,AU1000_UART2_INT ), +PORT (AU1000_UART3_PHYS_ADDR ,AU1000_UART3_INT ), + }, + [ALCHEMY_CPU_AU1500 ] = { +PORT (AU1000_UART0_PHYS_ADDR ,AU1500_UART0_INT ), +PORT (AU1000_UART3_PHYS_ADDR ,AU1500_UART3_INT ), + }, + [ALCHEMY_CPU_AU1100 ] = { +PORT (AU1000_UART0_PHYS_ADDR ,AU1100_UART0_INT ), +PORT (AU1000_UART1_PHYS_ADDR ,AU1100_UART1_INT ), +PORT (AU1000_UART3_PHYS_ADDR ,AU1100_UART3_INT ), + }, + [ALCHEMY_CPU_AU1550 ] = { +PORT (AU1000_UART0_PHYS_ADDR ,AU1550_UART0_INT ), +PORT (AU1000_UART1_PHYS_ADDR ,AU1550_UART1_INT ), +PORT (AU1000_UART3_PHYS_ADDR ,AU1550_UART3_INT ), + }, + [ALCHEMY_CPU_AU1200 ] = { +PORT (AU1000_UART0_PHYS_ADDR ,AU1200_UART0_INT ), +PORT (AU1000_UART1_PHYS_ADDR ,AU1200_UART1_INT ), + }, };static struct platform_device au1xx0_uart_device = { .name ="serial8250" , .id =PLAT8250_DEV_AU1X00 , - .dev = { - .platform_data = au1x00_uart_data, - }, }; +static void __init alchemy_setup_uarts (int ctype) +{ +unsigned int uartclk =get_au1x00_uart_baud_base () *16 ; +int s =sizeof (struct plat_serial8250_port ); +int c =alchemy_get_uarts (ctype); +struct plat_serial8250_port *ports; + + ports =kzalloc (s * (c +1 ),GFP_KERNEL ); +if (!ports) { +printk (KERN_INFO "Alchemy: no memory for UART data\n" ); +return ; + } +memcpy (ports, au1x00_uart_data[ctype], s * c); + au1xx0_uart_device.dev.platform_data = ports; + +/* Fill up uartclk. */ +for (s =0 ; s < c; s++) + ports[s].uartclk = uartclk; +if (platform_device_register (&au1xx0_uart_device)) +printk (KERN_INFO "Alchemy: failed to register UARTs\n" ); +} +/* OHCI (USB full speed host controller) */ static struct resource au1xxx_usb_ohci_resources[] = { [0 ] = {
@@ -442,7 +455,6 @@ void __init au1xxx_override_eth_cfg(unsigned int port, }static struct platform_device *au1xxx_platform_devices[]__initdata = { - &au1xx0_uart_device, &au1xxx_usb_ohci_device, #ifdef CONFIG_FB_AU1100 &au1100_lcd_device,
@@ -465,13 +477,10 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {static int __init au1xxx_platform_init (void ) { -unsigned int uartclk =get_au1x00_uart_baud_base () *16 ; -int err, i; +int err, i, ctype =alchemy_get_cputype ();unsigned char ethaddr[6 ]; -/* Fill up uartclk. */ -for (i =0 ; au1x00_uart_data[i].flags; i++) - au1x00_uart_data[i].uartclk = uartclk; +alchemy_setup_uarts (ctype);/* use firmware-provided mac addr if available and necessary */ i =prom_get_ethernet_addr (ethaddr);
arch/mips/alchemy/devboards/prom.c +1 -1
@@ -62,5 +62,5 @@ void __init prom_init(void)void prom_putchar (unsigned char c) { -alchemy_uart_putchar (UART0_PHYS_ADDR , c); +alchemy_uart_putchar (AU1000_UART0_PHYS_ADDR , c); }
arch/mips/alchemy/gpr/board_setup.c +4 -10
@@ -36,9 +36,6 @@#include <prom.h> -#define UART1_ADDR KSEG1ADDR(UART1_PHYS_ADDR) -#define UART3_ADDR KSEG1ADDR(UART3_PHYS_ADDR) -char irq_tab_alchemy[][5 ]__initdata = { [0 ] = {-1 ,AU1500_PCI_INTA ,AU1500_PCI_INTB ,0xff ,0xff }, };
@@ -67,18 +64,15 @@ static void gpr_power_off(void)void __init board_setup (void ) { -printk (KERN_INFO "Tarpeze ITS GPR board\n" ); +printk (KERN_INFO "Trapeze ITS GPR board\n" ); pm_power_off = gpr_power_off; _machine_halt = gpr_power_off; _machine_restart = gpr_reset; -/* Enable UART3 */ -au_writel (0x1 ,UART3_ADDR +UART_MOD_CNTRL );/* clock enable (CE) */ -au_writel (0x3 ,UART3_ADDR +UART_MOD_CNTRL );/* CE and "enable" */ -/* Enable UART1 */ -au_writel (0x1 ,UART1_ADDR +UART_MOD_CNTRL );/* clock enable (CE) */ -au_writel (0x3 ,UART1_ADDR +UART_MOD_CNTRL );/* CE and "enable" */ +/* Enable UART1/3 */ +alchemy_uart_enable (AU1000_UART3_PHYS_ADDR ); +alchemy_uart_enable (AU1000_UART1_PHYS_ADDR );/* Take away Reset of UMTS-card */ alchemy_gpio_direction_output (215 ,1 );
arch/mips/alchemy/gpr/init.c +1 -1
@@ -59,5 +59,5 @@ void __init prom_init(void)void prom_putchar (unsigned char c) { -alchemy_uart_putchar (UART0_PHYS_ADDR , c); +alchemy_uart_putchar (AU1000_UART0_PHYS_ADDR , c); }
arch/mips/alchemy/mtx-1/init.c +1 -1
@@ -62,5 +62,5 @@ void __init prom_init(void)void prom_putchar (unsigned char c) { -alchemy_uart_putchar (UART0_PHYS_ADDR , c); +alchemy_uart_putchar (AU1000_UART0_PHYS_ADDR , c); }
arch/mips/alchemy/xxs1500/board_setup.c +4 -7
@@ -66,13 +66,10 @@ void __init board_setup(void)au_writel (pin_func,SYS_PINFUNC );/* Enable UART */ -au_writel (0x01 ,UART3_ADDR +UART_MOD_CNTRL );/* clock enable (CE) */ -mdelay (10 ); -au_writel (0x03 ,UART3_ADDR +UART_MOD_CNTRL );/* CE and "enable" */ -mdelay (10 ); - -/* Enable DTR = USB power up */ -au_writel (0x01 ,UART3_ADDR +UART_MCR );/* UART_MCR_DTR is 0x01??? */ +alchemy_uart_enable (AU1000_UART3_PHYS_ADDR ); +/* Enable DTR (MCR bit 0) = USB power up */ +__raw_writel (1 , (void __iomem *)KSEG1ADDR (AU1000_UART3_PHYS_ADDR +0x18 )); +wmb ();#ifdef CONFIG_PCI #if defined(__MIPSEB__)
arch/mips/alchemy/xxs1500/init.c +1 -1
@@ -60,5 +60,5 @@ void __init prom_init(void)void prom_putchar (unsigned char c) { -alchemy_uart_putchar (UART0_PHYS_ADDR , c); +alchemy_uart_putchar (AU1000_UART0_PHYS_ADDR , c); }
arch/mips/boot/compressed/uart-alchemy.c +1 -1
@@ -3,5 +3,5 @@void putc (char c) {/* all current (Jan. 2010) in-kernel boards */ -alchemy_uart_putchar (UART0_PHYS_ADDR , c); +alchemy_uart_putchar (AU1000_UART0_PHYS_ADDR , c); }
arch/mips/include/asm/mach-au1x00/au1000.h +43 -14
99 lines not on this page · raw message
Signature · 1 line
1.7.5.rc3
Re: [PATCH 6/9] MIPS: Alchemy: rewrite UART setup and constants.
Thanks, queued for 2.6.40,
Ralf
PATCH 7/9 MIPS: Alchemy: rewrite ethernet platform setup
In reply to Manuel LaussRewrite ethernet setup to use runtime cpu detection, and also clean up the ethernet base address mess as far as possible.
--- arch/mips/alchemy/common/platform.c | 151 +++++++++++++++++++--------- arch/mips/include/asm/mach-au1x00/au1000.h | 63 ++++-------- 2 files changed, 123 insertions(+), 91 deletions(-)
arch/mips/alchemy/common/platform.c +101 -50
@@ -13,9 +13,10 @@#include <linux/dma-mapping.h> #include <linux/etherdevice.h> +#include <linux/init.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> -#include <linux/init.h> +#include <linux/slab.h> #include <asm/mach-au1x00/au1xxx.h> #include <asm/mach-au1x00/au1xxx_dbdma.h>
@@ -372,15 +373,16 @@ static struct platform_device pbdb_smbus_device = {#endif /* Macro to help defining the Ethernet MAC resources */ +#define MAC_RES_COUNT 3/* MAC regs base, MAC enable reg, MAC INT */ #define MAC_RES (_base, _enable, _irq) \ { \ - .start = CPHYSADDR(_base), \ - .end = CPHYSADDR(_base + 0xffff), \ + .start = _base, \ + .end = _base + 0xffff, \ .flags = IORESOURCE_MEM, \ }, \ { \ - .start = CPHYSADDR(_enable), \ - .end = CPHYSADDR(_enable + 0x3), \ + .start = _enable, \ + .end = _enable + 0x3, \ .flags = IORESOURCE_MEM, \ }, \ { \
@@ -389,19 +391,29 @@ static struct platform_device pbdb_smbus_device = { .flags = IORESOURCE_IRQ \ } -static struct resource au1xxx_eth0_resources[] = { -#if defined(CONFIG_SOC_AU1000 ) - MAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT), -#elif defined(CONFIG_SOC_AU1100 ) - MAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT), -#elif defined(CONFIG_SOC_AU1550 ) - MAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT), -#elif defined(CONFIG_SOC_AU1500 ) - MAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT), -#endif +static struct resource au1xxx_eth0_resources[][MAC_RES_COUNT ]__initdata = { + [ALCHEMY_CPU_AU1000 ] = { +MAC_RES (AU1000_MAC0_PHYS_ADDR , +AU1000_MACEN_PHYS_ADDR , +AU1000_MAC0_DMA_INT ) + }, + [ALCHEMY_CPU_AU1500 ] = { +MAC_RES (AU1500_MAC0_PHYS_ADDR , +AU1500_MACEN_PHYS_ADDR , +AU1500_MAC0_DMA_INT ) + }, + [ALCHEMY_CPU_AU1100 ] = { +MAC_RES (AU1000_MAC0_PHYS_ADDR , +AU1000_MACEN_PHYS_ADDR , +AU1100_MAC0_DMA_INT ) + }, + [ALCHEMY_CPU_AU1550 ] = { +MAC_RES (AU1000_MAC0_PHYS_ADDR , +AU1000_MACEN_PHYS_ADDR , +AU1550_MAC0_DMA_INT ) + }, }; -static struct au1000_eth_platform_data au1xxx_eth0_platform_data = { .phy1_search_mac0 =1 , };
@@ -409,20 +421,26 @@ static struct au1000_eth_platform_data au1xxx_eth0_platform_data = {static struct platform_device au1xxx_eth0_device = { .name ="au1000-eth" , .id =0 , - .num_resources =ARRAY_SIZE (au1xxx_eth0_resources), - .resource = au1xxx_eth0_resources, + .num_resources =MAC_RES_COUNT , .dev.platform_data = &au1xxx_eth0_platform_data, }; -#ifndef CONFIG_SOC_AU1100 -static struct resource au1xxx_eth1_resources[] = { -#if defined(CONFIG_SOC_AU1000) - MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT), -#elif defined(CONFIG_SOC_AU1550) - MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT), -#elif defined(CONFIG_SOC_AU1500) - MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT), -#endif +static struct resource au1xxx_eth1_resources[][MAC_RES_COUNT ]__initdata = { + [ALCHEMY_CPU_AU1000 ] = { +MAC_RES (AU1000_MAC1_PHYS_ADDR , +AU1000_MACEN_PHYS_ADDR +4 , +AU1000_MAC1_DMA_INT ) + }, + [ALCHEMY_CPU_AU1500 ] = { +MAC_RES (AU1500_MAC1_PHYS_ADDR , +AU1500_MACEN_PHYS_ADDR +4 , +AU1500_MAC1_DMA_INT ) + }, + [ALCHEMY_CPU_AU1550 ] = { +MAC_RES (AU1000_MAC1_PHYS_ADDR , +AU1000_MACEN_PHYS_ADDR +4 , +AU1550_MAC1_DMA_INT ) + }, };static struct au1000_eth_platform_data au1xxx_eth1_platform_data = {
@@ -432,11 +450,9 @@ static struct au1000_eth_platform_data au1xxx_eth1_platform_data = {static struct platform_device au1xxx_eth1_device = { .name ="au1000-eth" , .id =1 , - .num_resources =ARRAY_SIZE (au1xxx_eth1_resources), - .resource = au1xxx_eth1_resources, + .num_resources =MAC_RES_COUNT , .dev.platform_data = &au1xxx_eth1_platform_data, }; -#endif void __init au1xxx_override_eth_cfg (unsigned int port,struct au1000_eth_platform_data *eth_data)
@@ -447,11 +463,62 @@ void __init au1xxx_override_eth_cfg(unsigned int port,if (port ==0 )memcpy (&au1xxx_eth0_platform_data, eth_data,sizeof (struct au1000_eth_platform_data )); -#ifndef CONFIG_SOC_AU1100 else memcpy (&au1xxx_eth1_platform_data, eth_data,sizeof (struct au1000_eth_platform_data )); -#endif +} + +static void __init alchemy_setup_macs (int ctype) +{ +int ret, i; +unsigned char ethaddr[6 ]; +struct resource *macres; + +/* Handle 1st MAC */ +if (alchemy_get_macs (ctype) <1 ) +return ; + + macres =kmalloc (sizeof (struct resource ) *MAC_RES_COUNT ,GFP_KERNEL ); +if (!macres) { +printk (KERN_INFO "Alchemy: no memory for MAC0 resources\n" ); +return ; + } +memcpy (macres, au1xxx_eth0_resources[ctype], +sizeof (struct resource ) *MAC_RES_COUNT ); + au1xxx_eth0_device.resource = macres; + + i =prom_get_ethernet_addr (ethaddr); +if (!i && !is_valid_ether_addr (au1xxx_eth0_platform_data.mac)) +memcpy (au1xxx_eth0_platform_data.mac, ethaddr,6 ); + + ret =platform_device_register (&au1xxx_eth0_device); +if (!ret) +printk (KERN_INFO "Alchemy: failed to register MAC0\n" ); + + +/* Handle 2nd MAC */ +if (alchemy_get_macs (ctype) <2 ) +return ; + + macres =kmalloc (sizeof (struct resource ) *MAC_RES_COUNT ,GFP_KERNEL ); +if (!macres) { +printk (KERN_INFO "Alchemy: no memory for MAC1 resources\n" ); +return ; + } +memcpy (macres, au1xxx_eth1_resources[ctype], +sizeof (struct resource ) *MAC_RES_COUNT ); + au1xxx_eth1_device.resource = macres; + + ethaddr[5 ] +=1 ;/* next addr for 2nd MAC */ +if (!i && !is_valid_ether_addr (au1xxx_eth1_platform_data.mac)) +memcpy (au1xxx_eth1_platform_data.mac, ethaddr,6 ); + +/* Register second MAC if enabled in pinfunc */ +if (!(au_readl (SYS_PINFUNC ) & (u32 )SYS_PF_NI2 )) { + ret =platform_device_register (&au1xxx_eth1_device); +if (ret) +printk (KERN_INFO "Alchemy: failed to register MAC1\n" ); + } }static struct platform_device *au1xxx_platform_devices[]__initdata = {
@@ -472,33 +539,17 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {#ifdef SMBUS_PSC_BASE &pbdb_smbus_device,#endif - &au1xxx_eth0_device, };static int __init au1xxx_platform_init (void ) { -int err, i, ctype =alchemy_get_cputype (); -unsigned char ethaddr[6 ]; +int err, ctype =alchemy_get_cputype ();alchemy_setup_uarts (ctype); - -/* use firmware-provided mac addr if available and necessary */ - i =prom_get_ethernet_addr (ethaddr); -if (!i && !is_valid_ether_addr (au1xxx_eth0_platform_data.mac)) -memcpy (au1xxx_eth0_platform_data.mac, ethaddr,6 ); +alchemy_setup_macs (ctype); err =platform_add_devices (au1xxx_platform_devices,ARRAY_SIZE (au1xxx_platform_devices)); -#ifndef CONFIG_SOC_AU1100 - ethaddr[5 ] +=1 ;/* next addr for 2nd MAC */ -if (!i && !is_valid_ether_addr (au1xxx_eth1_platform_data.mac)) -memcpy (au1xxx_eth1_platform_data.mac, ethaddr,6 ); - -/* Register second MAC if enabled in pinfunc */ -if (!err && !(au_readl (SYS_PINFUNC ) & (u32 )SYS_PF_NI2 )) - err =platform_device_register (&au1xxx_eth1_device); -#endif -return err; }
arch/mips/include/asm/mach-au1x00/au1000.h +22 -41
129 lines not on this page · raw message
Signature · 1 line
1.7.5.rc3
Re: [PATCH 7/9] MIPS: Alchemy: rewrite ethernet platform setup
Thanks, queued for 2.6.40,
Ralf
PATCH 8/9 MIPS: Alchemy: cleanup DMA addresses
In reply to Manuel LaussAccording to the databooks, the Au1000 DMA engine must be programmed with the physical FIFO addresses. This patch does that; furthermore this opened the possibility to get rid of a lot of now unnecessary address defines.
--- arch/mips/alchemy/common/dma.c | 46 ++++++++++-------- arch/mips/alchemy/common/platform.c | 8 ++-- arch/mips/include/asm/mach-au1x00/au1000.h | 62 ++--------------------- arch/mips/include/asm/mach-au1x00/au1000_dma.h | 4 -- 4 files changed, 35 insertions(+), 85 deletions(-)
arch/mips/alchemy/common/dma.c +25 -21
@@ -58,6 +58,9 @@* returned from request_dma. */ +/* DMA Channel register block spacing */ +#define DMA_CHANNEL_LEN 0x00000100 +DEFINE_SPINLOCK (au1000_dma_spin_lock);struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS ] = {
@@ -77,22 +80,23 @@ static const struct dma_dev {unsigned int fifo_addr;unsigned int dma_mode; } dma_dev_table[DMA_NUM_DEV] = { - {UART0_ADDR + UART_TX, 0}, - {UART0_ADDR + UART_RX, 0}, - {0, 0}, - {0, 0}, - {AC97C_DATA, DMA_DW16 }, /* coherent */ - {AC97C_DATA, DMA_DR | DMA_DW16 }, /* coherent */ - {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, - {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, - {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC}, - {USBD_EP0WR, DMA_DW8 | DMA_NC}, - {USBD_EP2WR, DMA_DW8 | DMA_NC}, - {USBD_EP3WR, DMA_DW8 | DMA_NC}, - {USBD_EP4RD, DMA_DR | DMA_DW8 | DMA_NC}, - {USBD_EP5RD, DMA_DR | DMA_DW8 | DMA_NC}, - {I2S_DATA, DMA_DW32 | DMA_NC}, - {I2S_DATA, DMA_DR | DMA_DW32 | DMA_NC} + { AU1000_UART0_PHYS_ADDR + 0x04, DMA_DW8 }, /* UART0_TX */ + { AU1000_UART0_PHYS_ADDR + 0x00, DMA_DW8 | DMA_DR }, /* UART0_RX */ + { 0, 0 }, /* DMA_REQ0 */ + { 0, 0 }, /* DMA_REQ1 */ + { AU1000_AC97_PHYS_ADDR + 0x08, DMA_DW16 }, /* AC97 TX c */ + { AU1000_AC97_PHYS_ADDR + 0x08, DMA_DW16 | DMA_DR }, /* AC97 RX c */ + { AU1000_UART3_PHYS_ADDR + 0x04, DMA_DW8 | DMA_NC }, /* UART3_TX */ + { AU1000_UART3_PHYS_ADDR + 0x00, DMA_DW8 | DMA_NC | DMA_DR }, /* UART3_RX */ + { AU1000_USBD_PHYS_ADDR + 0x00, DMA_DW8 | DMA_NC | DMA_DR }, /* EP0RD */ + { AU1000_USBD_PHYS_ADDR + 0x04, DMA_DW8 | DMA_NC }, /* EP0WR */ + { AU1000_USBD_PHYS_ADDR + 0x08, DMA_DW8 | DMA_NC }, /* EP2WR */ + { AU1000_USBD_PHYS_ADDR + 0x0c, DMA_DW8 | DMA_NC }, /* EP3WR */ + { AU1000_USBD_PHYS_ADDR + 0x10, DMA_DW8 | DMA_NC | DMA_DR }, /* EP4RD */ + { AU1000_USBD_PHYS_ADDR + 0x14, DMA_DW8 | DMA_NC | DMA_DR }, /* EP5RD */ + /* on Au1500, these 2 are DMA_REQ2/3 (GPIO208/209) instead! */ + { AU1000_I2S_PHYS_ADDR + 0x00, DMA_DW32 | DMA_NC}, /* I2S TX */ + { AU1000_I2S_PHYS_ADDR + 0x00, DMA_DW32 | DMA_NC | DMA_DR}, /* I2S RX */ }; int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
@@ -123,10 +127,10 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,/* Device FIFO addresses and default DMA modes - 2nd bank */ static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2 ] = { - {SD0_XMIT_FIFO ,DMA_DS |DMA_DW8 },/* coherent */ - {SD0_RECV_FIFO ,DMA_DS |DMA_DR |DMA_DW8 },/* coherent */ - {SD1_XMIT_FIFO ,DMA_DS |DMA_DW8 },/* coherent */ - {SD1_RECV_FIFO ,DMA_DS |DMA_DR |DMA_DW8 }/* coherent */ + {AU1100_SD0_PHYS_ADDR +0x00 ,DMA_DS |DMA_DW8 },/* coherent */ + {AU1100_SD0_PHYS_ADDR +0x04 ,DMA_DS |DMA_DW8 |DMA_DR },/* coherent */ + {AU1100_SD1_PHYS_ADDR +0x00 ,DMA_DS |DMA_DW8 },/* coherent */ + {AU1100_SD1_PHYS_ADDR +0x04 ,DMA_DS |DMA_DW8 |DMA_DR }/* coherent */ };void dump_au1000_dma_channel (unsigned int dmanr)
@@ -202,7 +206,7 @@ int request_au1000_dma(int dev_id, const char *dev_str, }/* fill it in */ - chan->io =DMA_CHANNEL_BASE + i *DMA_CHANNEL_LEN ; + chan->io =KSEG1ADDR (AU1000_DMA_PHYS_ADDR ) + i *DMA_CHANNEL_LEN ; chan->dev_id = dev_id; chan->dev_str = dev_str; chan->fifo_addr = dev->fifo_addr;
arch/mips/alchemy/common/platform.c +4 -4
@@ -283,8 +283,8 @@ extern struct au1xmmc_platform_data au1xmmc_platdata[2];static struct resource au1200_mmc0_resources[] = { [0 ] = { - .start =SD0_PHYS_ADDR , - .end =SD0_PHYS_ADDR +0x7ffff , + .start =AU1100_SD0_PHYS_ADDR , + .end =AU1100_SD0_PHYS_ADDR +0xfff , .flags =IORESOURCE_MEM , }, [1 ] = {
@@ -319,8 +319,8 @@ static struct platform_device au1200_mmc0_device = { #ifndef CONFIG_MIPS_DB1200 static struct resource au1200_mmc1_resources[] = { [0] = { - .start = SD1_PHYS_ADDR, - .end = SD1_PHYS_ADDR + 0x7ffff, + .start = AU1100_SD1_PHYS_ADDR, + .end = AU1100_SD1_PHYS_ADDR + 0xfff, .flags = IORESOURCE_MEM, }, [1] = {
arch/mips/include/asm/mach-au1x00/au1000.h +6 -56
150 lines not on this page · raw message
arch/mips/include/asm/mach-au1x00/au1000_dma.h +0 -4
@@ -37,10 +37,6 @@#define NUM_AU1000_DMA_CHANNELS 8 -/* DMA Channel Base Addresses */ -#define DMA_CHANNEL_BASE 0xB4002000 -#define DMA_CHANNEL_LEN 0x00000100 -/* DMA Channel Register Offsets */ #define DMA_MODE_SET 0x00000000#define DMA_MODE_READ DMA_MODE_SET
Signature · 1 line
1.7.5.rc3
Re: [PATCH 8/9] MIPS: Alchemy: cleanup DMA addresses
Thanks, queued for 2.6.40,
Ralf
PATCH 9/9 MIPS: Alchemy: clean up GPIO registers and accessors
In reply to Manuel Laussremove au_readl/au_writel, remove the predefined GPIO1/2 KSEG1 register addresses and fix the fallout in all boards and drivers.
--- arch/mips/alchemy/devboards/pb1000/board_setup.c | 2 +- arch/mips/alchemy/devboards/pb1500/board_setup.c | 2 +- arch/mips/alchemy/mtx-1/board_setup.c | 2 +- arch/mips/include/asm/mach-au1x00/au1000.h | 27 +-------- arch/mips/include/asm/mach-au1x00/gpio-au1000.h | 71 +++++++++++++++------- drivers/watchdog/mtx-1_wdt.c | 21 ++++--- 6 files changed, 66 insertions(+), 59 deletions(-)
arch/mips/alchemy/devboards/pb1000/board_setup.c +1 -1
@@ -65,7 +65,7 @@ void __init board_setup(void)/* Set AUX clock to 12 MHz * 8 = 96 MHz */ au_writel (8 ,SYS_AUXPLL ); -au_writel (0 ,SYS_PINSTATERD ); +alchemy_gpio1_input_enable ();udelay (100 );#if defined(CONFIG_USB_OHCI_HCD ) || defined(CONFIG_USB_OHCI_HCD_MODULE )
arch/mips/alchemy/devboards/pb1500/board_setup.c +1 -1
@@ -56,7 +56,7 @@ void __init board_setup(void) sys_clksrc = sys_freqctrl = pin_func =0 ;/* Set AUX clock to 12 MHz * 8 = 96 MHz */ au_writel (8 ,SYS_AUXPLL ); -au_writel (0 ,SYS_PINSTATERD ); +alchemy_gpio1_input_enable ();udelay (100 );/* GPIO201 is input for PCMCIA card detect */
arch/mips/alchemy/mtx-1/board_setup.c +1 -1
@@ -87,7 +87,7 @@ void __init board_setup(void)au_writel (SYS_PF_NI2 ,SYS_PINFUNC );/* Initialize GPIO */ -au_writel (0xFFFFFFFF ,SYS_TRIOUTCLR ); +au_writel (~0 ,KSEG1ADDR (AU1000_SYS_PHYS_ADDR ) +SYS_TRIOUTCLR );alchemy_gpio_direction_output (0 ,0 );/* Disable M66EN (PCI 66MHz) */ alchemy_gpio_direction_output (3 ,1 );/* Disable PCI CLKRUN# */ alchemy_gpio_direction_output (1 ,1 );/* Enable EXT_IO3 */
arch/mips/include/asm/mach-au1x00/au1000.h +2 -25
@@ -702,7 +702,9 @@ enum soc_au1200_ints {#define AU1000_UART1_PHYS_ADDR 0x11200000/* 0234 */ #define AU1000_UART2_PHYS_ADDR 0x11300000/* 0 */ #define AU1000_UART3_PHYS_ADDR 0x11400000/* 0123 */ +#define AU1500_GPIO2_PHYS_ADDR 0x11700000/* 1234 */ #define AU1000_IC1_PHYS_ADDR 0x11800000/* 01234 */ +#define AU1000_SYS_PHYS_ADDR 0x11900000/* 01234 */ #define AU1000_DMA_PHYS_ADDR 0x14002000/* 012 */ #define AU1550_DBDMA_PHYS_ADDR 0x14002000/* 34 */ #define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000/* 34 */
@@ -717,7 +719,6 @@ enum soc_au1200_ints {#define IRDA_PHYS_ADDR 0x10300000#define SSI0_PHYS_ADDR 0x11600000#define SSI1_PHYS_ADDR 0x11680000 -#define SYS_PHYS_ADDR 0x11900000#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
@@ -730,8 +731,6 @@ enum soc_au1200_ints {#define STATIC_MEM_PHYS_ADDR 0x14001000#define USBH_PHYS_ADDR 0x10100000#define PCI_PHYS_ADDR 0x14005000 -#define GPIO2_PHYS_ADDR 0x11700000 -#define SYS_PHYS_ADDR 0x11900000#define PCI_MEM_PHYS_ADDR 0x400000000ULL#define PCI_IO_PHYS_ADDR 0x500000000ULL#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
@@ -750,8 +749,6 @@ enum soc_au1200_ints {#define IRDA_PHYS_ADDR 0x10300000#define SSI0_PHYS_ADDR 0x11600000#define SSI1_PHYS_ADDR 0x11680000 -#define GPIO2_PHYS_ADDR 0x11700000 -#define SYS_PHYS_ADDR 0x11900000#define LCD_PHYS_ADDR 0x15000000#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
@@ -765,8 +762,6 @@ enum soc_au1200_ints {#define STATIC_MEM_PHYS_ADDR 0x14001000#define USBH_PHYS_ADDR 0x14020000#define PCI_PHYS_ADDR 0x14005000 -#define GPIO2_PHYS_ADDR 0x11700000 -#define SYS_PHYS_ADDR 0x11900000#define PE_PHYS_ADDR 0x14008000#define PSC0_PHYS_ADDR 0x11A00000#define PSC1_PHYS_ADDR 0x11B00000
@@ -790,8 +785,6 @@ enum soc_au1200_ints {#define CIM_PHYS_ADDR 0x14004000#define USBM_PHYS_ADDR 0x14020000#define USBH_PHYS_ADDR 0x14020100 -#define GPIO2_PHYS_ADDR 0x11700000 -#define SYS_PHYS_ADDR 0x11900000#define PSC0_PHYS_ADDR 0x11A00000#define PSC1_PHYS_ADDR 0x11B00000#define LCD_PHYS_ADDR 0x15000000
@@ -1359,22 +1352,6 @@ enum soc_au1200_ints {#define SYS_PINFUNC_S1B (1 << 2)#endif -#define SYS_TRIOUTRD 0xB1900100 -#define SYS_TRIOUTCLR 0xB1900100 -#define SYS_OUTPUTRD 0xB1900108 -#define SYS_OUTPUTSET 0xB1900108 -#define SYS_OUTPUTCLR 0xB190010C -#define SYS_PINSTATERD 0xB1900110 -#define SYS_PININPUTEN 0xB1900110 - -/* GPIO2, Au1500, Au1550 only */ -#define GPIO2_BASE 0xB1700000 -#define GPIO2_DIR (GPIO2_BASE + 0) -#define GPIO2_OUTPUT (GPIO2_BASE + 8) -#define GPIO2_PINSTATE (GPIO2_BASE + 0xC) -#define GPIO2_INTENABLE (GPIO2_BASE + 0x10) -#define GPIO2_ENABLE (GPIO2_BASE + 0x14) -/* Power Management */ #define SYS_SCRATCH0 0xB1900018#define SYS_SCRATCH1 0xB190001C
arch/mips/include/asm/mach-au1x00/gpio-au1000.h +49 -22
144 lines not on this page · raw message
drivers/watchdog/mtx-1_wdt.c +12 -9
@@ -66,6 +66,7 @@ static struct {int default_ticks;unsigned long inuse;unsigned gpio; +int gstate; } mtx1_wdt_device;static void mtx1_wdt_trigger (unsigned long unused)
@@ -75,13 +76,13 @@ static void mtx1_wdt_trigger(unsigned long unused)spin_lock (&mtx1_wdt_device.lock);if (mtx1_wdt_device.running) ticks--; -/* -* toggle GPIO2_15 -*/ - tmp =au_readl (GPIO2_DIR ); - tmp = (tmp & ~(1 << mtx1_wdt_device.gpio)) | - ((~tmp) & (1 << mtx1_wdt_device.gpio)); -au_writel (tmp,GPIO2_DIR ); + +/* toggle wdt gpio */ + mtx1_wdt_device.gstate = ~mtx1_wdt_device.gstate; +if (mtx1_wdt_device.gstate) +gpio_direction_output (mtx1_wdt_device.gpio,1 ); +else +gpio_direction_input (mtx1_wdt_device.gpio);if (mtx1_wdt_device.queue && ticks)mod_timer (&mtx1_wdt_device.timer, jiffies +MTX1_WDT_INTERVAL );
@@ -103,7 +104,8 @@ static void mtx1_wdt_start(void)spin_lock_irqsave (&mtx1_wdt_device.lock, flags);if (!mtx1_wdt_device.queue) { mtx1_wdt_device.queue =1 ; -gpio_set_value (mtx1_wdt_device.gpio,1 ); + mtx1_wdt_device.gstate =1 ; +gpio_direction_output (mtx1_wdt_device.gpio,1 );mod_timer (&mtx1_wdt_device.timer, jiffies +MTX1_WDT_INTERVAL ); } mtx1_wdt_device.running++;
@@ -117,7 +119,8 @@ static int mtx1_wdt_stop(void)spin_lock_irqsave (&mtx1_wdt_device.lock, flags);if (mtx1_wdt_device.queue) { mtx1_wdt_device.queue =0 ; -gpio_set_value (mtx1_wdt_device.gpio,0 ); + mtx1_wdt_device.gstate =0 ; +gpio_direction_output (mtx1_wdt_device.gpio,0 ); } ticks = mtx1_wdt_device.default_ticks;spin_unlock_irqrestore (&mtx1_wdt_device.lock, flags);
Signature · 1 line
1.7.5.rc3
Re: [PATCH 9/9] MIPS: Alchemy: clean up GPIO registers and accessors
Thanks, queued for 2.6.40 - but you really should cc the watchdog folks, too!
Ralf
Re: [PATCH 9/9] MIPS: Alchemy: clean up GPIO registers and accessors
Quoted 1 line · Ralf Baechle
Thanks, queued for 2.6.40 - but you really should cc the watchdog folks, too!
Thank you. Yesterday I split some of the patches in this series; among them is a stand-alone version of the mtx-1 watchdog patch which I sent to the watchdog maintainer and list.
Manuel