Skip to content

Commit 07609ac

Browse files
committed
Merge branch 'bits/002-backports' into asahi-wip
2 parents 77a6edf + fe090b9 commit 07609ac

4 files changed

Lines changed: 46 additions & 62 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -575,30 +575,11 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
575575
return policy->transition_delay_us;
576576

577577
latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
578-
if (latency) {
579-
unsigned int max_delay_us = 2 * MSEC_PER_SEC;
578+
if (latency)
579+
/* Give a 50% breathing room between updates */
580+
return latency + (latency >> 1);
580581

581-
/*
582-
* If the platform already has high transition_latency, use it
583-
* as-is.
584-
*/
585-
if (latency > max_delay_us)
586-
return latency;
587-
588-
/*
589-
* For platforms that can change the frequency very fast (< 2
590-
* us), the above formula gives a decent transition delay. But
591-
* for platforms where transition_latency is in milliseconds, it
592-
* ends up giving unrealistic values.
593-
*
594-
* Cap the default transition delay to 2 ms, which seems to be
595-
* a reasonable amount of time after which we should reevaluate
596-
* the frequency.
597-
*/
598-
return min(latency * LATENCY_MULTIPLIER, max_delay_us);
599-
}
600-
601-
return LATENCY_MULTIPLIER;
582+
return USEC_PER_MSEC;
602583
}
603584
EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us);
604585

drivers/tty/serial/samsung_tty.c

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port)
550550
case TYPE_APPLE_S5L:
551551
s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTHRESH_ENA, S3C2410_UCON);
552552
s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTO_ENA, S3C2410_UCON);
553+
s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTO_LEGACY_ENA, S3C2410_UCON);
553554
break;
554555
default:
555556
disable_irq_nosync(ourport->rx_irq);
@@ -707,9 +708,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport)
707708

708709
static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport);
709710

710-
static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
711+
static irqreturn_t s3c24xx_serial_rx_chars_dma(struct s3c24xx_uart_port *ourport)
711712
{
712-
struct s3c24xx_uart_port *ourport = dev_id;
713713
struct uart_port *port = &ourport->port;
714714
struct s3c24xx_uart_dma *dma = ourport->dma;
715715
struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port);
@@ -843,9 +843,8 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
843843
tty_flip_buffer_push(&port->state->port);
844844
}
845845

846-
static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id)
846+
static irqreturn_t s3c24xx_serial_rx_chars_pio(struct s3c24xx_uart_port *ourport)
847847
{
848-
struct s3c24xx_uart_port *ourport = dev_id;
849848
struct uart_port *port = &ourport->port;
850849

851850
uart_port_lock(port);
@@ -855,13 +854,11 @@ static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id)
855854
return IRQ_HANDLED;
856855
}
857856

858-
static irqreturn_t s3c24xx_serial_rx_irq(int irq, void *dev_id)
857+
static irqreturn_t s3c24xx_serial_rx_irq(struct s3c24xx_uart_port *ourport)
859858
{
860-
struct s3c24xx_uart_port *ourport = dev_id;
861-
862859
if (ourport->dma && ourport->dma->rx_chan)
863-
return s3c24xx_serial_rx_chars_dma(dev_id);
864-
return s3c24xx_serial_rx_chars_pio(dev_id);
860+
return s3c24xx_serial_rx_chars_dma(ourport);
861+
return s3c24xx_serial_rx_chars_pio(ourport);
865862
}
866863

867864
static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
@@ -928,9 +925,8 @@ static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
928925
s3c24xx_serial_stop_tx(port);
929926
}
930927

931-
static irqreturn_t s3c24xx_serial_tx_irq(int irq, void *id)
928+
static irqreturn_t s3c24xx_serial_tx_irq(struct s3c24xx_uart_port *ourport)
932929
{
933-
struct s3c24xx_uart_port *ourport = id;
934930
struct uart_port *port = &ourport->port;
935931

936932
uart_port_lock(port);
@@ -944,17 +940,17 @@ static irqreturn_t s3c24xx_serial_tx_irq(int irq, void *id)
944940
/* interrupt handler for s3c64xx and later SoC's.*/
945941
static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id)
946942
{
947-
const struct s3c24xx_uart_port *ourport = id;
943+
struct s3c24xx_uart_port *ourport = id;
948944
const struct uart_port *port = &ourport->port;
949945
u32 pend = rd_regl(port, S3C64XX_UINTP);
950946
irqreturn_t ret = IRQ_HANDLED;
951947

952948
if (pend & S3C64XX_UINTM_RXD_MSK) {
953-
ret = s3c24xx_serial_rx_irq(irq, id);
949+
ret = s3c24xx_serial_rx_irq(ourport);
954950
wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_RXD_MSK);
955951
}
956952
if (pend & S3C64XX_UINTM_TXD_MSK) {
957-
ret = s3c24xx_serial_tx_irq(irq, id);
953+
ret = s3c24xx_serial_tx_irq(ourport);
958954
wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_TXD_MSK);
959955
}
960956
return ret;
@@ -963,19 +959,21 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id)
963959
/* interrupt handler for Apple SoC's.*/
964960
static irqreturn_t apple_serial_handle_irq(int irq, void *id)
965961
{
966-
const struct s3c24xx_uart_port *ourport = id;
962+
struct s3c24xx_uart_port *ourport = id;
967963
const struct uart_port *port = &ourport->port;
968964
u32 pend = rd_regl(port, S3C2410_UTRSTAT);
969965
irqreturn_t ret = IRQ_NONE;
970966

971-
if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO)) {
967+
if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO |
968+
APPLE_S5L_UTRSTAT_RXTO_LEGACY)) {
972969
wr_regl(port, S3C2410_UTRSTAT,
973-
APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO);
974-
ret = s3c24xx_serial_rx_irq(irq, id);
970+
APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO |
971+
APPLE_S5L_UTRSTAT_RXTO_LEGACY);
972+
ret = s3c24xx_serial_rx_irq(ourport);
975973
}
976974
if (pend & APPLE_S5L_UTRSTAT_TXTHRESH) {
977975
wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_TXTHRESH);
978-
ret = s3c24xx_serial_tx_irq(irq, id);
976+
ret = s3c24xx_serial_tx_irq(ourport);
979977
}
980978

981979
return ret;
@@ -1195,7 +1193,8 @@ static void apple_s5l_serial_shutdown(struct uart_port *port)
11951193
ucon = rd_regl(port, S3C2410_UCON);
11961194
ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK |
11971195
APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
1198-
APPLE_S5L_UCON_RXTO_ENA_MSK);
1196+
APPLE_S5L_UCON_RXTO_ENA_MSK |
1197+
APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK);
11991198
wr_regl(port, S3C2410_UCON, ucon);
12001199

12011200
wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_ALL_FLAGS);
@@ -1292,6 +1291,7 @@ static int apple_s5l_serial_startup(struct uart_port *port)
12921291
/* Enable Rx Interrupt */
12931292
s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTHRESH_ENA, S3C2410_UCON);
12941293
s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTO_ENA, S3C2410_UCON);
1294+
s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTO_LEGACY_ENA, S3C2410_UCON);
12951295

12961296
return ret;
12971297
}
@@ -2148,13 +2148,15 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
21482148

21492149
ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK |
21502150
APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
2151-
APPLE_S5L_UCON_RXTO_ENA_MSK);
2151+
APPLE_S5L_UCON_RXTO_ENA_MSK |
2152+
APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK);
21522153

21532154
if (ourport->tx_enabled)
21542155
ucon |= APPLE_S5L_UCON_TXTHRESH_ENA_MSK;
21552156
if (ourport->rx_enabled)
21562157
ucon |= APPLE_S5L_UCON_RXTHRESH_ENA_MSK |
2157-
APPLE_S5L_UCON_RXTO_ENA_MSK;
2158+
APPLE_S5L_UCON_RXTO_ENA_MSK |
2159+
APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK;
21582160

21592161
wr_regl(port, S3C2410_UCON, ucon);
21602162

@@ -2541,7 +2543,7 @@ static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = {
25412543
.name = "Apple S5L UART",
25422544
.type = TYPE_APPLE_S5L,
25432545
.port_type = PORT_8250,
2544-
.iotype = UPIO_MEM,
2546+
.iotype = UPIO_MEM32,
25452547
.fifosize = 16,
25462548
.rx_fifomask = S3C2410_UFSTAT_RXMASK,
25472549
.rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
@@ -2827,6 +2829,9 @@ OF_EARLYCON_DECLARE(gs101, "google,gs101-uart", gs101_early_console_setup);
28272829
static int __init apple_s5l_early_console_setup(struct earlycon_device *device,
28282830
const char *opt)
28292831
{
2832+
/* Apple A7-A11 requires MMIO32 register accesses. */
2833+
device->port.iotype = UPIO_MEM32;
2834+
28302835
/* Close enough to S3C2410 for earlycon... */
28312836
device->port.private_data = &s3c2410_early_console_data;
28322837

include/linux/cpufreq.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,6 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
577577
#define CPUFREQ_POLICY_POWERSAVE (1)
578578
#define CPUFREQ_POLICY_PERFORMANCE (2)
579579

580-
/*
581-
* The polling frequency depends on the capability of the processor. Default
582-
* polling frequency is 1000 times the transition latency of the processor.
583-
*/
584-
#define LATENCY_MULTIPLIER (1000)
585-
586580
struct cpufreq_governor {
587581
char name[CPUFREQ_NAME_LEN];
588582
int (*init)(struct cpufreq_policy *policy);

include/linux/serial_s3c.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -246,24 +246,28 @@
246246
S5PV210_UFCON_TXTRIG4 | \
247247
S5PV210_UFCON_RXTRIG4)
248248

249-
#define APPLE_S5L_UCON_RXTO_ENA 9
250-
#define APPLE_S5L_UCON_RXTHRESH_ENA 12
251-
#define APPLE_S5L_UCON_TXTHRESH_ENA 13
252-
#define APPLE_S5L_UCON_RXTO_ENA_MSK (1 << APPLE_S5L_UCON_RXTO_ENA)
253-
#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK (1 << APPLE_S5L_UCON_RXTHRESH_ENA)
254-
#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK (1 << APPLE_S5L_UCON_TXTHRESH_ENA)
249+
#define APPLE_S5L_UCON_RXTO_ENA 9
250+
#define APPLE_S5L_UCON_RXTO_LEGACY_ENA 11
251+
#define APPLE_S5L_UCON_RXTHRESH_ENA 12
252+
#define APPLE_S5L_UCON_TXTHRESH_ENA 13
253+
#define APPLE_S5L_UCON_RXTO_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_ENA)
254+
#define APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_LEGACY_ENA)
255+
#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_RXTHRESH_ENA)
256+
#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_TXTHRESH_ENA)
255257

256258
#define APPLE_S5L_UCON_DEFAULT (S3C2410_UCON_TXIRQMODE | \
257259
S3C2410_UCON_RXIRQMODE | \
258260
S3C2410_UCON_RXFIFO_TOI)
259261
#define APPLE_S5L_UCON_MASK (APPLE_S5L_UCON_RXTO_ENA_MSK | \
262+
APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK | \
260263
APPLE_S5L_UCON_RXTHRESH_ENA_MSK | \
261264
APPLE_S5L_UCON_TXTHRESH_ENA_MSK)
262265

263-
#define APPLE_S5L_UTRSTAT_RXTHRESH (1<<4)
264-
#define APPLE_S5L_UTRSTAT_TXTHRESH (1<<5)
265-
#define APPLE_S5L_UTRSTAT_RXTO (1<<9)
266-
#define APPLE_S5L_UTRSTAT_ALL_FLAGS (0x3f0)
266+
#define APPLE_S5L_UTRSTAT_RXTO_LEGACY BIT(3)
267+
#define APPLE_S5L_UTRSTAT_RXTHRESH BIT(4)
268+
#define APPLE_S5L_UTRSTAT_TXTHRESH BIT(5)
269+
#define APPLE_S5L_UTRSTAT_RXTO BIT(9)
270+
#define APPLE_S5L_UTRSTAT_ALL_FLAGS GENMASK(9, 3)
267271

268272
#ifndef __ASSEMBLY__
269273

0 commit comments

Comments
 (0)