mrst_earlyprintk: add a kmsg_dumper to dump the printk buffer when panic
Subsystems (2)
PATCH 1/5 mrst_earlyprintk: add a kmsg_dumper to dump the printk buffer when panic
From: Feng Tang <[email protected]>
As normal max3110 console can't work during panic case, add a helper function which make debug easier
---
arch/x86/Kconfig | 18 ++ arch/x86/Kconfig.debug | 4 + arch/x86/include/asm/mrst.h | 5 + arch/x86/kernel/Makefile | 1 arch/x86/kernel/early_printk.c | 5 + arch/x86/kernel/mrst_earlyprintk.c | 283 ++++++++++++++++++++++++++++++++++++ 6 files changed, 311 insertions(+), 5 deletions(-) create mode 100644 arch/x86/kernel/mrst_earlyprintk.c
arch/x86/Kconfig +13 -5
@@ -420,6 +420,14 @@ config X86_MRST nor standard legacy replacement devices/features. e.g. Moorestown does not contain i8259, i8254, HPET, legacy BIOS, most of the io ports. +config MRST_SPI_UART_BOOT_MSG + def_bool y + prompt "Moorestown SPI UART boot message" + depends on (X86_MRST && X86_32) + help + Enable this to see boot message during protected mode boot phase, such as + kernel decompression, BAUD rate is set at 115200 8n1 + config X86_RDC321X bool "RDC R-321x SoC" depends on X86_32
@@ -630,11 +638,11 @@ config APB_TIMER def_bool y if MRST prompt "Langwell APB Timer Support" if X86_MRST help - APB timer is the replacement for 8254, HPET on X86 MID platforms. - The APBT provides a stable time base on SMP - systems, unlike the TSC, but it is more expensive to access, - as it is off-chip. APB timers are always running regardless of CPU - C states, they are used as per CPU clockevent device when possible. + APB timer is the replacement for 8254, HPET on X86 MID platforms. + The APBT provides a stable time base on SMP + systems, unlike the TSC, but it is more expensive to access, + as it is off-chip. APB timers are always running regardless of CPU + C states, they are used as per CPU clockevent device when possible. # Mark as embedded because too many people got it wrong. # The code disables itself when not needed.
arch/x86/Kconfig.debug +4 -0
@@ -43,6 +43,10 @@ config EARLY_PRINTK with klogd/syslogd or the X server. You should normally N here, unless you want to debug such a crash. +config X86_MRST_EARLY_PRINTK + bool "Early printk for MRST platform support" + depends on EARLY_PRINTK && X86_MRST + config EARLY_PRINTK_DBGP bool "Early printk via EHCI debug port" depends on EARLY_PRINTK && PCI
arch/x86/include/asm/mrst.h +5 -0
@@ -10,6 +10,9 @@*/ #ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_H + +#include <linux/sfi.h> +extern int pci_mrst_init (void );int __init sfi_parse_mrtc (struct sfi_table_header *table);
@@ -42,4 +45,6 @@ extern enum mrst_timer_options mrst_timer_options;#define SFI_MTMR_MAX_NUM 8#define SFI_MRTC_MAX 8 +extern struct console early_mrst_console; +extern void mrst_early_printk (const char *fmt, ...);#endif /* _ASM_X86_MRST_H */
arch/x86/kernel/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_VM86) += vm86_32.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_X86_MRST_EARLY_PRINTK) += mrst_earlyprintk.o obj-$(CONFIG_HPET_TIMER) += hpet.o obj-$(CONFIG_APB_TIMER) += apb_timer.o
arch/x86/kernel/early_printk.c +5 -0
@@ -14,6 +14,7 @@#include <xen/hvc-console.h> #include <asm/pci-direct.h> #include <asm/fixmap.h> +#include <asm/mrst.h> #include <asm/pgtable.h> #include <linux/usb/ehci_def.h>
@@ -239,6 +240,10 @@ static int __init setup_early_printk(char *buf)if (!strncmp (buf,"xen" ,3 ))early_console_register (&xenboot_console, keep);#endif +#ifdef CONFIG_X86_MRST_EARLY_PRINTK +if (!strncmp (buf,"mrst" ,4 )) +early_console_register (&early_mrst_console, keep); +#endif buf++; }return 0 ;
arch/x86/kernel/mrst_earlyprintk.c new file +283 -0
283 lines not on this page · raw message
PATCH 2/5 hsu, earlyprintk: add early printk for hsu_port2 console
From: Feng Tang <[email protected]>
To enable early printk of HSU console, simply set "earlyprint=hsu" in kernel command line.
Currently we put the code in the mrst_earlyprintk.c and it need enable CONFIG_X86_MRST_EARLY_PRINTK config option
---
arch/x86/include/asm/mrst.h | 1 arch/x86/kernel/early_printk.c | 3 + arch/x86/kernel/mrst_earlyprintk.c | 128 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 0 deletions(-)
arch/x86/include/asm/mrst.h +1 -0
@@ -46,5 +46,6 @@ extern enum mrst_timer_options mrst_timer_options;#define SFI_MRTC_MAX 8extern struct console early_mrst_console; +extern struct console early_hsu_console;extern void mrst_early_printk (const char *fmt, ...);#endif /* _ASM_X86_MRST_H */
arch/x86/kernel/early_printk.c +3 -0
@@ -243,6 +243,9 @@ static int __init setup_early_printk(char *buf)#ifdef CONFIG_X86_MRST_EARLY_PRINTK if (!strncmp (buf,"mrst" ,4 ))early_console_register (&early_mrst_console, keep); + +if (!strncmp (buf,"hsu" ,3 )) +early_console_register (&early_hsu_console, keep);#endif buf++; }
arch/x86/kernel/mrst_earlyprintk.c +128 -0
140 lines not on this page · raw message
PATCH 3/5 hsu, earlyprintk: remove the GPIO work around
In reply to Alan CoxFrom: Feng Tang <[email protected]>
Latest firmware will correctly configure the GPIO lines used by hsu console, so remove that workaround.
---
arch/x86/kernel/mrst_earlyprintk.c | 20 -------------------- 1 files changed, 0 insertions(+), 20 deletions(-)
arch/x86/kernel/mrst_earlyprintk.c +0 -20
@@ -287,17 +287,10 @@ void mrst_early_printk(const char *fmt, ...)/* Will use HSU port2 for early console */ - -/* -* Note: -* 1. still need GPIO workaround for UART2 -* -*/ static spinlock_t hsu_lock;static int hsu_inited;static void __iomem *phsu;#define HSU_PORT2_PADDR 0xffa28180 -#define MFD_GPIO_HSU_REG 0xff12c064static void early_hsu_init (void ) {
@@ -308,13 +301,6 @@ static void early_hsu_init(void)spin_lock_init (&hsu_lock); -/* GPIO workaround */ -set_fixmap_nocache (FIX_EARLYCON_MEM_BASE ,MFD_GPIO_HSU_REG ); - phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + - (MFD_GPIO_HSU_REG & (PAGE_SIZE -1 ))); - - *((u32 *)phsu) =0x55465 ; -set_fixmap_nocache (FIX_EARLYCON_MEM_BASE ,HSU_PORT2_PADDR ); phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + (HSU_PORT2_PADDR & (PAGE_SIZE -1 )));
@@ -338,8 +324,6 @@ static void early_hsu_init(void)readb (phsu +UART_IIR );readb (phsu +UART_MSR ); - -writeb (0x7 , phsu +UART_FCR ); hsu_inited =1 ;
@@ -371,10 +355,6 @@ static void early_hsu_write(struct console *con,int i;unsigned long flags; -/* -printk("%s(): enter\n\n", __func__); -*/ -if (unlikely (!hsu_inited))early_hsu_init ();
PATCH 4/5 serial: mrst_max3110: some code cleanup
In reply to Alan CoxFrom: Feng Tang <[email protected]>
The cleanup for mrst_max3110 includes:
* remove unneeded head files
* make the spi_transfer dma safe, so that driver is more portable
* add more check for error return value
* use mutex_trylock for read thread
---
drivers/serial/mrst_max3110.c | 323 +++++++++++++++++++++++++---------------- drivers/serial/mrst_max3110.h | 1 2 files changed, 199 insertions(+), 125 deletions(-)
drivers/serial/mrst_max3110.c +198 -125
@@ -1,7 +1,7 @@/* -* max3110.c - spi uart protocol driver for Maxim 3110 on Moorestown +* mrst_max3110.c - spi uart protocol driver for Maxim 3110 * -* Copyright (C) Intel 2008 Feng Tang <[email protected]> +* Copyright (c) 2010, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -31,18 +31,13 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/console.h> -#include <linux/sysrq.h> -#include <linux/platform_device.h> #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial_reg.h> #include <linux/kthread.h> -#include <linux/delay.h> -#include <asm/atomic.h> #include <linux/spi/spi.h> -#include <linux/spi/dw_spi.h> #include "mrst_max3110.h"
@@ -55,7 +50,7 @@struct uart_max3110 {struct uart_port port;struct spi_device *spi; -char *name; +char name[24 ];wait_queue_head_t wq;struct task_struct *main_thread;
@@ -66,35 +61,30 @@ struct uart_max3110 {u16 cur_conf;u8 clock;u8 parity, word_7bits; +u16 irq;unsigned long uart_flags;/* console related */ struct circ_buf con_xmit; - -/* irq related */ -u16 irq; };/* global data structure, may need be removed */ -struct uart_max3110 *pmax; -static inline void receive_char (struct uart_max3110 *max,u8 ch); +static struct uart_max3110 *pmax; +static void receive_chars (struct uart_max3110 *max,unsigned char *str,int len); -static int max3110_read_multi (struct uart_max3110 *max,int len,u8 *buf); -static void max3110_console_receive (struct uart_max3110 *max); +static int max3110_read_multi (struct uart_max3110 *max,u8 *buf); +static void max3110_con_receive (struct uart_max3110 *max); -int max3110_write_then_read (struct uart_max3110 *max, -const u8 *txbuf,u8 *rxbuf,unsigned len,int always_fast) +static int max3110_write_then_read (struct uart_max3110 *max, +const void *txbuf,void *rxbuf,unsigned len,int always_fast) {struct spi_device *spi = max->spi;struct spi_message message;struct spi_transfer x;int ret; -if (!txbuf || !rxbuf) -return -EINVAL ; -spi_message_init (&message);memset (&x,0 ,sizeof x); x.len = len;
@@ -103,7 +93,7 @@ int max3110_write_then_read(struct uart_max3110 *max,spi_message_add_tail (&x, &message);if (always_fast) - x.speed_hz =3125000 ; + x.speed_hz = spi->max_speed_hz;else if (max->baud) x.speed_hz = max->baud;
@@ -112,58 +102,80 @@ int max3110_write_then_read(struct uart_max3110 *max,return ret; } -/* Write a u16 to the device, and return one u16 read back */ -int max3110_out (struct uart_max3110 *max,const u16 out) +/* Write a 16b word to the device */ +static int max3110_out (struct uart_max3110 *max,const u16 out) { -u16 tmp; +void *buf; +u16 *obuf, *ibuf; +u8 ch;int ret; - ret =max3110_write_then_read (max, (u8 *)&out, (u8 *)&tmp,2 ,1 ); -if (ret) -return ret; + buf =kzalloc (8 ,GFP_KERNEL |GFP_DMA ); +if (!buf) +return -ENOMEM ; + + obuf = buf; + ibuf = buf +4 ; + *obuf = out; + ret =max3110_write_then_read (max, obuf, ibuf,2 ,1 ); +if (ret) { +pr_warning (PR_FMT "%s(): get err msg %d when sending 0x%x\n" , + __func__, ret, out); + goto exit; + }/* If some valid data is read back */ -if (tmp &MAX3110_READ_DATA_AVAILABLE ) -receive_char (max, (tmp &0xff )); +if (*ibuf &MAX3110_READ_DATA_AVAILABLE ) { + ch = *ibuf &0xff ; +receive_chars (max, &ch,1 ); + } +exit: +kfree (buf);return ret; } -#define MAX_READ_LEN 20/* * This is usually used to read data from SPIC RX FIFO, which doesn't -* need any delay like flushing character out. It returns how many -* valide bytes are read back +* need any delay like flushing character out. +* +* Return how many valide bytes are read back */ -static int max3110_read_multi (struct uart_max3110 *max,int len,u8 *buf) +static int max3110_read_multi (struct uart_max3110 *max,u8 *rxbuf) { -u16 out[MAX_READ_LEN ], in[MAX_READ_LEN ]; -u8 *pbuf, valid_str[MAX_READ_LEN ]; -int i, j, bytelen; +void *buf; +u16 *obuf, *ibuf; +u8 *pbuf, valid_str[M3110_RX_FIFO_DEPTH ]; +int i, j, blen; -if (len >MAX_READ_LEN ) { -pr_err (PR_FMT "read len %d is too large\n" , len); + blen =M3110_RX_FIFO_DEPTH *sizeof (u16); + buf =kzalloc (blen *2 ,GFP_KERNEL |GFP_DMA ); +if (!buf) { +pr_warning (PR_FMT "%s(): fail to alloc dma buffer\n" , __func__);return 0 ; } - bytelen = len *2 ; -memset (out,0 , bytelen); -memset (in,0 , bytelen); +/* tx/rx always have the same length */ + obuf = buf; + ibuf = buf + blen; -if (max3110_write_then_read (max, (u8 *)out, (u8 *)in, bytelen,1 )) +if (max3110_write_then_read (max, obuf, ibuf, blen,1 )) { +kfree (buf);return 0 ; + } -/* If caller don't provide a buffer, then handle received char */ - pbuf = buf ? buf : valid_str; +/* If caller doesn't provide a buffer, then handle received char */ + pbuf = rxbuf ? rxbuf : valid_str; -for (i =0 , j =0 ; i < len; i++) { -if (in[i] &MAX3110_READ_DATA_AVAILABLE ) - pbuf[j++] = (u8)(in[i] &0xff ); +for (i =0 , j =0 ; i <M3110_RX_FIFO_DEPTH ; i++) { +if (ibuf[i] &MAX3110_READ_DATA_AVAILABLE ) + pbuf[j++] = ibuf[i] &0xff ; }if (j && (pbuf == valid_str))receive_chars (max, valid_str, j); +kfree (buf);return j; }
@@ -177,10 +189,6 @@ static void serial_m3110_con_putchar(struct uart_port *port, int ch) xmit->buf[xmit->head] = (char )ch; xmit->head = (xmit->head +1 ) & (PAGE_SIZE -1 ); } - - -if (!test_and_set_bit (CON_TX_NEEDED , &max->uart_flags)) -wake_up_process (max->main_thread); }/*
@@ -196,6 +204,9 @@ static void serial_m3110_con_write(struct console *co,return ;uart_console_write (&pmax->port, s, count, serial_m3110_con_putchar); + +if (!test_and_set_bit (CON_TX_NEEDED , &pmax->uart_flags)) +wake_up_process (pmax->main_thread); } static int __init
@@ -209,6 +220,9 @@ serial_m3110_con_setup(struct console *co, char *options)pr_info (PR_FMT "setting up console\n" ); +if (co->index ==-1 ) + co->index =0 ; +if (!max) {pr_err (PR_FMT "pmax is NULL, return" );return -ENODEV ;
@@ -239,8 +253,6 @@ static struct console serial_m3110_console = { .data = &serial_m3110_reg, }; -#define MRST_CONSOLE (&serial_m3110_console) -static unsigned int serial_m3110_tx_empty (struct uart_port *port) {return 1 ;
@@ -258,32 +270,44 @@ static void serial_m3110_stop_rx(struct uart_port *port) }#define WORDS_PER_XFER 128 -static inline void send_circ_buf (struct uart_max3110 *max, +static void send_circ_buf (struct uart_max3110 *max,struct circ_buf *xmit) { -int len, left =0 ; -u16 obuf[WORDS_PER_XFER ], ibuf[WORDS_PER_XFER ]; +void *buf; +u16 *obuf, *ibuf;u8 valid_str[WORDS_PER_XFER ]; -int i, j; +int i, j, len, blen, dma_size, left, ret =0 ; + + + dma_size =WORDS_PER_XFER *sizeof (u16) *2 ; + buf =kzalloc (dma_size,GFP_KERNEL |GFP_DMA ); +if (!buf) +return ; + obuf = buf; + ibuf = buf + dma_size/2 ;while (!uart_circ_empty (xmit)) { left =uart_circ_chars_pending (xmit);while (left) { - len = (left >=WORDS_PER_XFER ) ?WORDS_PER_XFER : left; + len =min (left,WORDS_PER_XFER ); + blen = len *sizeof (u16); +memset (ibuf,0 , blen); -memset (obuf,0 , len *2 ); -memset (ibuf,0 , len *2 );for (i =0 ; i < len; i++) { obuf[i] = (u8 )xmit->buf[xmit->tail] |WD_TAG ; xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 ); } -max3110_write_then_read (max, (u8 *)obuf, - (u8 *)ibuf, len *2 ,0 ); + +/* Fail to send msg to console is not very critical */ + ret =max3110_write_then_read (max, obuf, ibuf, blen,0 ); +if (ret) +pr_warning (PR_FMT "%s(): get err msg %d\n" , + __func__, ret);for (i =0 , j =0 ; i < len; i++) {if (ibuf[i] &MAX3110_READ_DATA_AVAILABLE ) - valid_str[j++] = (u8)(ibuf[i] &0xff ); + valid_str[j++] = ibuf[i] &0xff ; }if (j)
@@ -293,6 +317,8 @@ static inline void send_circ_buf(struct uart_max3110 *max, left -= len; } } + +kfree (buf); }static void transmit_char (struct uart_max3110 *max)
@@ -312,8 +338,10 @@ static void transmit_char(struct uart_max3110 *max)serial_m3110_stop_tx (port); } -/* This will be called by uart_write() and tty_write, can't -* go to sleep */ +/* +* This will be called by uart_write() and tty_write, can't +* go to sleep +*/ static void serial_m3110_start_tx (struct uart_port *port) { struct uart_max3110 *max =
@@ -335,7 +363,7 @@ static void receive_chars(struct uart_max3110 *max, unsigned char *str, int len) tty = port->state->port.tty;if (!tty) -return ;/* receive some char before the tty is opened */ +return ;while (len) { usable =tty_buffer_request_room (tty, len);
@@ -343,32 +371,37 @@ static void receive_chars(struct uart_max3110 *max, unsigned char *str, int len)tty_insert_flip_string (tty, str, usable); str += usable; port->icount.rx += usable; -tty_flip_buffer_push (tty); } len -= usable; } +tty_flip_buffer_push (tty); } -static inline void receive_char (struct uart_max3110 *max,u8 ch) -{ -receive_chars (max, &ch,1 ); -} - -static void max3110_console_receive (struct uart_max3110 *max) +/* +* This routine will be used in read_thread or RX IRQ handling, +* it will first do one round buffer read(8 words), if there is some +* valid RX data, will try to read 5 more rounds till all data +* is read out. +* +* Use stack space as data buffer to save some system load, and chose +* 504 Btyes as a threadhold to do a bulk push to upper tty layer when +* receiving bulk data, a much bigger buffer may cause stack overflow +*/ +static void max3110_con_receive (struct uart_max3110 *max) {int loop =1 , num, total =0 ;u8 recv_buf[512 ], *pbuf; pbuf = recv_buf; do { - num = max3110_read_multi(max, 8, pbuf); + num = max3110_read_multi(max, pbuf); if (num) { - loop = 10; + loop = 5; pbuf += num; total += num; - if (total >= 500) { + if (total >= 504) { receive_chars(max, recv_buf, total); pbuf = recv_buf; total = 0;
@@ -396,7 +429,7 @@ static int max3110_main_thread(void *_max)mutex_lock (&max->thread_mutex);if (test_and_clear_bit (BIT_IRQ_PENDING , &max->uart_flags)) -max3110_console_receive (max); +max3110_con_receive (max);/* first handle console output */ if (test_and_clear_bit (CON_TX_NEEDED , &max->uart_flags))
@@ -433,9 +466,14 @@ static int max3110_read_thread(void *_max)pr_info (PR_FMT "start read thread\n" ); do { - mutex_lock(&max->thread_mutex); - max3110_console_receive(max); - mutex_unlock(&max->thread_mutex); + /* + * If can't acquire the mutex, it means the main thread + * is running which will also perform the rx job + */ + if (mutex_trylock(&max->thread_mutex)) { + max3110_con_receive(max); + mutex_unlock(&max->thread_mutex); + } set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ / 20);
@@ -452,15 +490,16 @@ static int serial_m3110_startup(struct uart_port *port)u16 config =0 ;int ret =0 ; -if (port->line !=0 ) +if (port->line !=0 ) {pr_err (PR_FMT "uart port startup failed\n" ); +return -1 ; + } -/* firstly disable all IRQ and config it to 115200, 8n1 */ +/* Disable all IRQ and config it to 115200, 8n1 */ config =WC_TAG |WC_FIFO_ENABLE |WC_1_STOPBITS |WC_8BIT_WORD |WC_BAUD_DR2 ; - ret =max3110_out (max, config);/* as we use thread to handle tx/rx, need set low latency */ port->state->port.tty->low_latency =1 ;
@@ -471,14 +510,30 @@ static int serial_m3110_startup(struct uart_port *port)if (ret)return ret; -/* enable RX IRQ only */ +/* Enable RX IRQ only */ config |=WC_RXA_IRQ_ENABLE ; -max3110_out (max, config);#else -/* if IRQ is disabled, start a read thread for input data */ +/* If IRQ is disabled, start a read thread for input data */ max->read_thread =kthread_run (max3110_read_thread, max,"max3110_read" ); +if (IS_ERR (max->read_thread)) { + ret =PTR_ERR (max->read_thread); + max->read_thread =NULL ; +pr_err (PR_FMT "Can't create read thread!" ); +return ret; + } +#endif + + ret =max3110_out (max, config); +if (ret) { +#ifdef CONFIG_MRST_MAX3110_IRQ +free_irq (max->irq, max); +#else +kthread_stop (max->read_thread); + max->read_thread =NULL ;#endif +return ret; + } max->cur_conf = config;return 0 ;
@@ -515,8 +570,7 @@ static int serial_m3110_request_port(struct uart_port *port)static void serial_m3110_config_port (struct uart_port *port,int flags) { -/* give it fake type */ - port->type =PORT_PXA ; + port->type =PORT_MAX3100 ; } static int
@@ -551,6 +605,9 @@ serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios, new_conf |=WC_7BIT_WORD ;break ;default : +/* We only support CS7 & CS8 */ + termios->c_cflag &= ~CSIZE ; + termios->c_cflag |=CS8 ;case CS8 : cval =UART_LCR_WLEN8 ; new_conf |=WC_8BIT_WORD ;
@@ -559,7 +616,7 @@ serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios, baud =uart_get_baud_rate (port, termios, old,0 ,230400 ); -/* first calc the div for 1.8MHZ clock case */ +/* First calc the div for 1.8MHZ clock case */ switch (baud) {case 300 : clk_div =WC_BAUD_DR384 ;
@@ -595,7 +652,7 @@ serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios,if (max->clock &MAX3110_HIGH_CLK )break ;default : -/* pick the previous baud rate */ +/* Pick the previous baud rate */ baud = max->baud; clk_div = max->cur_conf &WC_BAUD_DIV_MASK ;tty_termios_encode_baud_rate (termios, baud, baud);
@@ -603,15 +660,21 @@ serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios,if (max->clock &MAX3110_HIGH_CLK ) { clk_div +=1 ; -/* high clk version max3110 doesn't support B300 */ -if (baud ==300 ) +/* High clk version max3110 doesn't support B300 */ +if (baud ==300 ) { baud =600 ; + clk_div =WC_BAUD_DR384 ; + }if (baud ==230400 ) clk_div =WC_BAUD_DR1 ;tty_termios_encode_baud_rate (termios, baud, baud); } new_conf = (new_conf & ~WC_BAUD_DIV_MASK ) | clk_div; + +if (unlikely (termios->c_cflag &CMSPAR )) + termios->c_cflag &= ~CMSPAR ; +if (termios->c_cflag &CSTOPB ) new_conf |=WC_2_STOPBITS ;else
@@ -631,13 +694,14 @@ serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios, new_conf |=WC_TAG ;if (new_conf != max->cur_conf) { -max3110_out (max, new_conf); - max->cur_conf = new_conf; - max->baud = baud; +if (!max3110_out (max, new_conf)) { + max->cur_conf = new_conf; + max->baud = baud; + } } } -/* don't handle hw handshaking */ +/* Don't handle hw handshaking */ static unsigned int serial_m3110_get_mctrl (struct uart_port *port) {return TIOCM_DSR |TIOCM_CAR |TIOCM_DSR ;
@@ -671,7 +735,7 @@ struct uart_ops serial_m3110_ops = { .break_ctl = serial_m3110_break_ctl, .startup = serial_m3110_startup, .shutdown = serial_m3110_shutdown, - .set_termios = serial_m3110_set_termios, /* must have */ + .set_termios = serial_m3110_set_termios, .pm = serial_m3110_pm, .type = serial_m3110_type, .release_port = serial_m3110_release_port,
@@ -687,44 +751,52 @@ static struct uart_driver serial_m3110_reg = { .major = TTY_MAJOR, .minor = 64, .nr = 1, - .cons = MRST_CONSOLE, + .cons = &serial_m3110_console, }; +#ifdef CONFIG_PM static int serial_m3110_suspend (struct spi_device *spi,pm_message_t state) { +struct uart_max3110 *max =spi_get_drvdata (spi); + +disable_irq (max->irq); +uart_suspend_port (&serial_m3110_reg, &max->port); +max3110_out (max, max->cur_conf |WC_SW_SHDI );return 0 ; }static int serial_m3110_resume (struct spi_device *spi) { +struct uart_max3110 *max =spi_get_drvdata (spi); + +max3110_out (max, max->cur_conf); +uart_resume_port (&serial_m3110_reg, &max->port); +enable_irq (max->irq);return 0 ; } +#else +#define serial_m3110_suspend NULL +#define serial_m3110_resume NULL +#endif -static struct dw_spi_chip spi0_uart = { - .poll_mode =1 , - .enable_dma =0 , - .type =SPI_FRF_SPI , -}; - -static int serial_m3110_probe (struct spi_device *spi) +static int __devinit serial_m3110_probe (struct spi_device *spi) {struct uart_max3110 *max; -int ret; -unsigned char *buffer; +void *buffer;u16 res; +int ret =0 ; + max =kzalloc (sizeof (*max),GFP_KERNEL );if (!max)return -ENOMEM ; -/* set spi info */ - spi->mode =SPI_MODE_0 ; +/* Set spi info */ spi->bits_per_word =16 ; max->clock =MAX3110_HIGH_CLK ; - spi->controller_data = &spi0_uart;spi_setup (spi); - max->port.type =PORT_PXA ;/* need apply for a max3110 type */ + max->port.type =PORT_MAX3100 ;/* need apply for a max3110 type */ max->port.fifosize =2 ;/* only have 16b buffer */ max->port.ops = &serial_m3110_ops; max->port.line =0 ;
@@ -732,7 +804,7 @@ static int serial_m3110_probe(struct spi_device *spi) max->port.uartclk =115200 ; max->spi = spi; - max->name = spi->modalias;/* use spi name as the name */ +strcpy (max->name, spi->modalias); max->irq = (u16 )spi->irq;mutex_init (&max->thread_mutex);
@@ -754,13 +826,15 @@ static int serial_m3110_probe(struct spi_device *spi) ret = -ENODEV ; goto err_get_page; } - buffer = (unsigned char *)__get_free_page (GFP_KERNEL ); + + buffer = (void *)__get_free_page (GFP_KERNEL );if (!buffer) { ret = -ENOMEM ; goto err_get_page; } - max->con_xmit.buf = (unsigned char *)buffer; - max->con_xmit.head = max->con_xmit.tail =0 ; + max->con_xmit.buf = buffer; + max->con_xmit.head =0 ; + max->con_xmit.tail =0 ; max->main_thread =kthread_run (max3110_main_thread, max,"max3110_main" );
@@ -769,7 +843,9 @@ static int serial_m3110_probe(struct spi_device *spi) goto err_kthread; } +spi_set_drvdata (spi, max); pmax = max; +/* give membase a psudo value to pass serial_core's check */ max->port.membase = (void *)0xff110000 ;uart_add_one_port (&serial_m3110_reg, &max->port);
@@ -779,19 +855,17 @@ static int serial_m3110_probe(struct spi_device *spi) err_kthread:free_page ((unsigned long )buffer); err_get_page: - pmax =NULL ;kfree (max);return ret; } -static int max3110_remove (struct spi_device *dev) +static int __devexit serial_m3110_remove(struct spi_device *dev) { -struct uart_max3110 *max = pmax; +struct uart_max3110 *max =spi_get_drvdata (dev); -if (!pmax) +if (!max)return 0 ; - pmax =NULL ;uart_remove_one_port (&serial_m3110_reg, &max->port);free_page ((unsigned long )max->con_xmit.buf);
@@ -810,13 +884,12 @@ static struct spi_driver uart_max3110_driver = { .owner = THIS_MODULE, }, .probe = serial_m3110_probe, - .remove = __devexit_p(max3110_remove), + .remove = __devexit_p(serial_m3110_remove), .suspend = serial_m3110_suspend, .resume = serial_m3110_resume, }; - -int __init serial_m3110_init (void ) +static int __init serial_m3110_init (void ) {int ret =0 ;
@@ -831,7 +904,7 @@ int __init serial_m3110_init(void)return ret; } -void __exit serial_m3110_exit(void) +static void __exit serial_m3110_exit(void) {spi_unregister_driver (&uart_max3110_driver);uart_unregister_driver (&serial_m3110_reg);
@@ -840,5 +913,5 @@ void __exit serial_m3110_exit(void)module_init (serial_m3110_init);module_exit (serial_m3110_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" );MODULE_ALIAS ("max3110-uart" );
drivers/serial/mrst_max3110.h +1 -0
@@ -56,4 +56,5 @@#define WC_BAUD_DR192 (0xE)#define WC_BAUD_DR384 (0xF) +#define M3110_RX_FIFO_DEPTH 8#endif
PATCH 5/5 mrst_max3110: Make the IRQ option runtime
In reply to Alan CoxAnd while we are at it allow it to fail to find one. Without this the IRQ option will cause the 3110 driver to fail on 0.7 SFI firmware.
---
drivers/serial/Kconfig | 7 ----- drivers/serial/mrst_max3110.c | 55 +++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 34 deletions(-)
drivers/serial/Kconfig +0 -7
@@ -717,13 +717,6 @@ config SERIAL_MRST_MAX3110 the Intel Moorestown platform. On other systems use the max3100 driver. -config MRST_MAX3110_IRQ - boolean "Enable GPIO IRQ for Max3110 over Moorestown" - default n - depends on SERIAL_MRST_MAX3110 && GPIO_LANGWELL - help - This has to be enabled after Moorestown GPIO driver is loaded - config SERIAL_MFD_HSU tristate "Medfield High Speed UART support" depends on PCI
drivers/serial/mrst_max3110.c +28 -27
92 lines not on this page · raw message
Re: [PATCH 2/5] hsu, earlyprintk: add early printk for hsu_port2 console
In reply to Alan CoxQuoted 8 lines · Alan Cox
From: Feng Tang <[email protected]>
To enable early printk of HSU console, simply set "earlyprint=hsu" in kernel command line.
Currently we put the code in the
mrst_earlyprintk.cand it need enableCONFIG_X86_MRST_EARLY_PRINTKconfig option
Quoted 8 lines
Signed-off-by Feng Tang <[email protected]>Signed-off-by Alan Cox <[email protected]>---
arch/x86/include/asm/mrst.h | 1 arch/x86/kernel/early_printk.c | 3 + arch/x86/kernel/mrst_earlyprintk.c | 128 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 0 deletions(-)
Please Cc: x86 patches to the x86 maintainers.
Quoted 46 lines
arch/x86/include/asm/mrst.h +1
-0@@ -46,5 +46,6 @@ extern enum mrst_timer_options mrst_timer_options;#define SFI_MRTC_MAX 8extern struct console early_mrst_console; +extern struct console early_hsu_console;extern void mrst_early_printk (const char *fmt, ...);#endif /* _ASM_X86_MRST_H */ arch/x86/kernel/early_printk.c +3
-0@@ -243,6 +243,9 @@ static int __init setup_early_printk(char *buf)#ifdef CONFIG_X86_MRST_EARLY_PRINTK if (!strncmp (buf,"mrst" ,4 ))early_console_register (&early_mrst_console, keep); + +if (!strncmp (buf,"hsu" ,3 )) +early_console_register (&early_hsu_console, keep);#endif buf++; }arch/x86/kernel/mrst_earlyprintk.c +3
-0@@ -9,9 +9,12 @@* of the License. */ +#include <linux/serial_reg.h> +#include <linux/serial_mfd.h> #include <linux/kmsg_dump.h> #include <linux/console.h> #include <linux/kernel.h> +#include <linux/delay.h> #include <linux/init.h> #include <linux/io.h> @@ -281,3 +284,128 @@ void mrst_early_printk(const char *fmt, ...) early_mrst_console.write (&early_mrst_console, buf, n); }
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 296
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c +10
-0+ + +/* Will use HSU port2 for early console */ + +/* +* Note: +* 1. still need GPIO workaround for UART2 +* +*/ +static spinlock_t hsu_lock;
Please use DEFINE_SPINLOCK().
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 297
Quoted 1 line
arch/x86/kernel/mrst_earlyprintk.c +1
-0+static int hsu_inited;
'initialized' is the proper English word i think.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 299
Quoted 2 lines
arch/x86/kernel/mrst_earlyprintk.c +2
-0+static void __iomem *phsu; +#define HSU_PORT2_PADDR 0xffa28180
Newline undersupply.
(Please use newlines to separate blocks of different types of definitions.)
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 307
Quoted 9 lines
arch/x86/kernel/mrst_earlyprintk.c +8
-0+#define MFD_GPIO_HSU_REG 0xff12c064 + +static void early_hsu_init (void ) +{ +u8 lcr; + +if (phsu && hsu_inited) +return ;
Surely one of those will suffice as a "have we initialized" flag?
Also, under what circumstances can we call early_hsu_init() twice?
arch/x86/kernel/mrst_earlyprintk.c
Quoted 2 lines
arch/x86/kernel/mrst_earlyprintk.c +2
-0+ +spin_lock_init (&hsu_lock);
Can be removed if it's DEFINE_SPINLOCK() declared.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 316
Quoted 7 lines
arch/x86/kernel/mrst_earlyprintk.c +7
-0+ +/* GPIO workaround */ +set_fixmap_nocache (FIX_EARLYCON_MEM_BASE ,MFD_GPIO_HSU_REG ); + phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + + (MFD_GPIO_HSU_REG & (PAGE_SIZE -1 ))); + + *((u32 *)phsu) =0x55465 ;
What does 0x55465 stand for?
Quoted 16 lines
arch/x86/kernel/mrst_earlyprintk.c +16
-0+ +set_fixmap_nocache (FIX_EARLYCON_MEM_BASE ,HSU_PORT2_PADDR ); + phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + + (HSU_PORT2_PADDR & (PAGE_SIZE -1 ))); + +writeb (0x0 , phsu +UART_FCR ); + +/* set to default 115200 */ + lcr =readb (phsu +UART_LCR ); +writeb ((0x80 | lcr), phsu +UART_LCR ); +writeb (0x18 , phsu +UART_DLL ); +writeb (lcr, phsu +UART_LCR ); +writel (0x3600 , phsu +UART_MUL *4 ); + +writeb (0x8 , phsu +UART_MCR ); +writeb (0x7 , phsu +UART_FCR );
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 342
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c +10
-0+writeb (0x3 , phsu +UART_LCR ); + +/* clear IRQ status */ +readb (phsu +UART_LSR ); +readb (phsu +UART_RX ); +readb (phsu +UART_IIR ); +readb (phsu +UART_MSR ); + + +
Newline oversupply.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 349
Quoted 7 lines
arch/x86/kernel/mrst_earlyprintk.c +7
-0+writeb (0x7 , phsu +UART_FCR ); + + hsu_inited =1 ; +} + +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) +static void early_hsu_putc (char ch)
Newline undersupply.
Quoted 4 lines
arch/x86/kernel/mrst_earlyprintk.c +4
-0+{ +unsigned int timeout =10000 ;/* 10ms*/ +u8 status; +
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 363
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c +10
-0+while (timeout--) { + status =readb (phsu +UART_LSR ); +if (status &BOTH_EMPTY ) +break ; + +udelay (1 ); + } + +if (timeout ==0xffffffff ) +return ;
Using the -1 literal will dtrt too, and will be slightly clearer to the potentially overworked reader of such patches.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 369
Quoted 6 lines
arch/x86/kernel/mrst_earlyprintk.c +6
-0+ +writeb (ch, phsu +UART_TX ); +} + +static void early_hsu_write (struct console *con, +const char *str,unsigned n)
Unnecessary linebreak. Ignore checkpatch when it suggests crap.
arch/x86/kernel/mrst_earlyprintk.c
Quoted 2 lines
arch/x86/kernel/mrst_earlyprintk.c +2
-0+{ +int i;
Space character oversupply.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 376
Quoted 5 lines
arch/x86/kernel/mrst_earlyprintk.c +5
-0+unsigned long flags; + +/* +printk("%s(): enter\n\n", __func__); +*/
Can go away i suspect.
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 379
Quoted 3 lines
arch/x86/kernel/mrst_earlyprintk.c +3
-0+ +if (unlikely (!hsu_inited)) +early_hsu_init ();
We check the 'hsu_inited' flag in early_hsu_init() too. One of the checks is superfluous.
arch/x86/kernel/mrst_earlyprintk.c
Quoted 2 lines
arch/x86/kernel/mrst_earlyprintk.c +2
-0+ +spin_lock_irqsave (&hsu_lock, flags);
In early_printk code we generally try to avoid the use of spinlocks.
It is a 'console of last resort', and we try to keep it as simple as possible. The current early_printk.c code does not have a single spinlock, and still it's robust and usable in a wide range of circumstances, is NMI safe, etc.
With allowing early_hsu_putc() to execute in parallel, we at most can lose a character, because the UART's BOTH_EMPTY state might be stale. But it's not a real issue in practice: default earlyprintk is turned off way before SMP initializes.
Quoted 20 lines
arch/x86/kernel/mrst_earlyprintk.c +20
-0+for (i =0 ; i < n && *str; i++) { +if (*str =='\n' ) +early_hsu_putc ('\r' ); +early_hsu_putc (*str); + + str++; + } +spin_unlock_irqrestore (&hsu_lock, flags); +} + + +struct console early_hsu_console = { + .name ="earlyhsu" , + .write = early_hsu_write, + .flags =CON_PRINTBUFFER , + .index =-1 , +}; + +void hsu_early_printk (const char *fmt, ...) +{
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 411
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c +10
-0+char buf[512 ]; +int n; +va_list ap; + +va_start (ap, fmt); + n =vscnprintf (buf,512 , fmt, ap); +va_end (ap); + + early_hsu_console.write (&early_mrst_console, buf, n); +}
Instead of this hack that duplicates much of early_printk() please add something like:
extern void __earlyprintk(struct console *con, ...)
and then hsa_early_printk() becomes:
#define hsu_early_printk(x...) __early_printk(&earlymrst_console, x...)
... or so - and other subsystems may make use of it as well, to implement their own special unconditional-printout routines.
Thanks,
Ingo
Re: [PATCH 2/5] hsu, earlyprintk: add early printk for hsu_port2 console
Quoted 1 line
Please Cc: x86 patches to the x86 maintainers.
Sure - I should probably have also cc'd Feng - I've forwarded it and added Feng so it doesn't get missed.
Quoted 3 lines
Quoted 1 line
+static int
hsu_inited;'initialized' is the proper English word i think.
Then we should probably run /sbin/initialize in future ;) inited is perfectly fine computerspeak and much less typing.
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 307
Quoted 6 lines
arch/x86/kernel/mrst_earlyprintk.c +6
-0+static void early_hsu_init (void ) +{ +u8 lcr; + +if (phsu && hsu_inited) +return ;Surely one of those will suffice as a "have we initialized" flag?
Also, under what circumstances can we call
early_hsu_init()twice?
Don't think we can
Quoted 9 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 316
Quoted 7 lines
(quoted diff) +2
-0+ /* GPIO workaround */ + set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
MFD_GPIO_HSU_REG);arch/x86/kernel/mrst_earlyprintk.c +4
-0+ phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + + (MFD_GPIO_HSU_REG & (PAGE_SIZE -1 ))); + + *((u32 *)phsu) =0x55465 ;What does
0x55465stand for?
It's a firmware fixup. Its a magic value (even to most of us who work here ;)). Feng - am I right in thinking we don't need that anyway with the current firmware ?
Quoted 9 lines
Quoted 9 lines
arch/x86/kernel/mrst_earlyprintk.c +9
-0+{ +unsigned int timeout =10000 ;/* 10ms*/ +u8 status; + +while (timeout--) { + status =readb (phsu +UART_LSR ); +if (status &BOTH_EMPTY ) +break ; +
Quoted 8 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 363
Quoted 5 lines
arch/x86/kernel/mrst_earlyprintk.c +5
-0+udelay (1 ); + } + +if (timeout ==0xffffffff ) +return ;Using the -1 literal will dtrt too, and will be slightly clearer to the potentially overworked reader of such patches.
If they have a degree in C sign propagation. Better is probably
while (--timeout) {..
}Re: [PATCH 2/5] hsu, earlyprintk: add early printk for hsu_port2 console
Quoted 4 lines · Alan Cox
Quoted 1 line
Please Cc: x86 patches to the x86 maintainers.
Sure - I should probably have also cc'd Feng - I've forwarded it and added Feng so it doesn't get missed.
thx.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+static int
hsu_inited;'initialized' is the proper English word i think.
Then we should probably run
/sbin/initializein future ;) [...]
Fortunately there's no /sbin/inited.
Quoted 1 line
[...] inited is perfectly fine computerspeak and much less typing.
It's a distinctly annoying grammar mistake (to me at least) and it only comes up very rarely in the kernel - which has its fair share of annoying grammar otherwise.
As per a quick & dirty 'git grep' run we have 4267 (96%) instances of 'initialized' and only 174 (4%) 'inited' instances usage right now.
hsu_init_done might be a compromise?
But ... no strong feelings in any case. If you the native speaker are not annoyed by reading 'inited' then i guess i'm in the minority.
Quoted 23 lines
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 307
Quoted 6 lines
arch/x86/kernel/mrst_earlyprintk.c +6
-0+static void early_hsu_init (void ) +{ +u8 lcr; + +if (phsu && hsu_inited) +return ;Surely one of those will suffice as a "have we initialized" flag?
Also, under what circumstances can we call
early_hsu_init()twice?Don't think we can
Quoted 9 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 316
Quoted 7 lines
(quoted diff) +2
-0+ /* GPIO workaround */ + set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
MFD_GPIO_HSU_REG);arch/x86/kernel/mrst_earlyprintk.c +4
-0+ phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + + (MFD_GPIO_HSU_REG & (PAGE_SIZE -1 ))); + + *((u32 *)phsu) =0x55465 ;What does
0x55465stand for?
Quoted 3 lines
It's a firmware fixup. Its a magic value (even to most of us who work here ;)). Feng - am I right in thinking we don't need that anyway with the current firmware ?
If it's some magic number it's worth symbolizing it - keeping future generations of happy mrst hackers from wondering at that incantation.
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c +9
-0+{ +unsigned int timeout =10000 ;/* 10ms*/ +u8 status; + +while (timeout--) { + status =readb (phsu +UART_LSR ); +if (status &BOTH_EMPTY ) +break ; +Quoted 8 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 363
Quoted 5 lines
arch/x86/kernel/mrst_earlyprintk.c +5
-0+udelay (1 ); + } + +if (timeout ==0xffffffff ) +return ;Using the -1 literal will dtrt too, and will be slightly clearer to the potentially overworked reader of such patches.
Quoted 1 line
If they have a degree in C sign propagation.
My 8yo son knows it that the next number below zero is -1, and he distinctly has no degree in C sign propagation rules. But you are right to point out the correct solution:
Quoted 4 lines
[...] Better is probably
while (--timeout) {.. }
indeed.
Thanks,
Ingo
Re: [PATCH 2/5] hsu, earlyprintk: add early printk for hsu_port2 console
In reply to Alan CoxQuoted 11 lines · On Mon, 6 Sep 2010 22:15:42 +0800 Alan Cox <[email protected]> wrote:
Quoted 10 lines
arch/x86/kernel/mrst_earlyprintk.c void mrst_early_printk(const char *fmt, ...) · line 316
Quoted 8 lines
(quoted diff) +2
-0+ /* GPIO workaround */ + set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
MFD_GPIO_HSU_REG);arch/x86/kernel/mrst_earlyprintk.c +4
-0+ phsu = (void *)(__fix_to_virt (FIX_EARLYCON_MEM_BASE ) + + (MFD_GPIO_HSU_REG & (PAGE_SIZE -1 ))); + + *((u32 *)phsu) =0x55465 ;What does
0x55465stand for?
Quoted 3 lines
It's a firmware fixup. Its a magic value (even to most of us who work here ;)). Feng - am I right in thinking we don't need that anyway with the current firmware ?
Yes, it's a fixup for firmware, it set GPIO controller's register to correctly configure the GPIO lines used by HSU. Latest firmware already fix that, and it could be removed.
Thank you both for the comments, will try to address them and make a v2.
Thanks,
Feng