Skip to content

Commit f52b69f

Browse files
committed
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Pull SuperH updates from Paul Mundt. * tag 'sh-for-linus' of git://github.com/pmundt/linux-sh: (25 commits) sh: Support I/O space swapping where needed. sh: use set_current_blocked() and block_sigmask() sh: no need to reset handler if SA_ONESHOT sh: intc: Fix up section mismatch for intc_ack_data sh: select ARCH_DISCARD_MEMBLOCK. sh: Consolidate duplicate _32/_64 unistd definitions. sh: ecovec: switch SDHI controllers to card polling sh: Avoid exporting unimplemented syscalls. sh: add platform_device for RSPI in setup-sh7757 SH: pci-sh7780: enable big-endian operation. serial: sh-sci: fix a race of DMA submit_tx on transfer sh: dma: Collect up CHCR of SH7763, SH7764, SH7780 and SH7785 sh: dma: Collect up CHCR of SH7723 and SH7730 sh/next: Fix build fail by asm/system.h in asm/bitops.h arch/sh/drivers/dma/{dma-g2,dmabrg}.c: ensure arguments to request_irq and free_irq are compatible sh: cpufreq: Wire up scaling_available_freqs support. sh: cpufreq: notify about rate rounding fallback. sh: cpufreq: Support CPU clock frequency table. sh: cpufreq: struct device lookup from CPU topology. sh: cpufreq: percpu struct clk accounting. ...
2 parents 2f7fa1b + b7e68d6 commit f52b69f

22 files changed

Lines changed: 420 additions & 371 deletions

File tree

‎arch/sh/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config SUPERH
55
select HAVE_IDE if HAS_IOPORT
66
select HAVE_MEMBLOCK
77
select HAVE_MEMBLOCK_NODE_MAP
8+
select ARCH_DISCARD_MEMBLOCK
89
select HAVE_OPROFILE
910
select HAVE_GENERIC_DMA_COHERENT
1011
select HAVE_ARCH_TRACEHOOK
@@ -161,6 +162,9 @@ config NO_IOPORT
161162
config IO_TRAPPED
162163
bool
163164

165+
config SWAP_IO_SPACE
166+
bool
167+
164168
config DMA_COHERENT
165169
bool
166170

‎arch/sh/boards/mach-ecovec24/setup.c‎

Lines changed: 63 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,18 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
522522
gpio_set_value(GPIO_PTB6, state);
523523
}
524524

525+
static int sdhi0_get_cd(struct platform_device *pdev)
526+
{
527+
return !gpio_get_value(GPIO_PTY7);
528+
}
529+
525530
static struct sh_mobile_sdhi_info sdhi0_info = {
526531
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
527532
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
528533
.set_pwr = sdhi0_set_pwr,
529-
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
534+
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
535+
MMC_CAP_NEEDS_POLL,
536+
.get_cd = sdhi0_get_cd,
530537
};
531538

532539
static struct resource sdhi0_resources[] = {
@@ -559,11 +566,18 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
559566
gpio_set_value(GPIO_PTB7, state);
560567
}
561568

569+
static int sdhi1_get_cd(struct platform_device *pdev)
570+
{
571+
return !gpio_get_value(GPIO_PTW7);
572+
}
573+
562574
static struct sh_mobile_sdhi_info sdhi1_info = {
563575
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
564576
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
565-
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
577+
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
578+
MMC_CAP_NEEDS_POLL,
566579
.set_pwr = sdhi1_set_pwr,
580+
.get_cd = sdhi1_get_cd,
567581
};
568582

569583
static struct resource sdhi1_resources[] = {
@@ -1001,6 +1015,7 @@ extern char ecovec24_sdram_leave_end;
10011015
static int __init arch_setup(void)
10021016
{
10031017
struct clk *clk;
1018+
bool cn12_enabled = false;
10041019

10051020
/* register board specific self-refresh code */
10061021
sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
@@ -1201,9 +1216,13 @@ static int __init arch_setup(void)
12011216
gpio_direction_input(GPIO_PTR5);
12021217
gpio_direction_input(GPIO_PTR6);
12031218

1219+
/* SD-card slot CN11 */
1220+
/* Card-detect, used on CN11, either with SDHI0 or with SPI */
1221+
gpio_request(GPIO_PTY7, NULL);
1222+
gpio_direction_input(GPIO_PTY7);
1223+
12041224
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
12051225
/* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
1206-
gpio_request(GPIO_FN_SDHI0CD, NULL);
12071226
gpio_request(GPIO_FN_SDHI0WP, NULL);
12081227
gpio_request(GPIO_FN_SDHI0CMD, NULL);
12091228
gpio_request(GPIO_FN_SDHI0CLK, NULL);
@@ -1213,23 +1232,6 @@ static int __init arch_setup(void)
12131232
gpio_request(GPIO_FN_SDHI0D0, NULL);
12141233
gpio_request(GPIO_PTB6, NULL);
12151234
gpio_direction_output(GPIO_PTB6, 0);
1216-
1217-
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1218-
/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1219-
gpio_request(GPIO_FN_SDHI1CD, NULL);
1220-
gpio_request(GPIO_FN_SDHI1WP, NULL);
1221-
gpio_request(GPIO_FN_SDHI1CMD, NULL);
1222-
gpio_request(GPIO_FN_SDHI1CLK, NULL);
1223-
gpio_request(GPIO_FN_SDHI1D3, NULL);
1224-
gpio_request(GPIO_FN_SDHI1D2, NULL);
1225-
gpio_request(GPIO_FN_SDHI1D1, NULL);
1226-
gpio_request(GPIO_FN_SDHI1D0, NULL);
1227-
gpio_request(GPIO_PTB7, NULL);
1228-
gpio_direction_output(GPIO_PTB7, 0);
1229-
1230-
/* I/O buffer drive ability is high for SDHI1 */
1231-
__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1232-
#endif /* CONFIG_MMC_SH_MMCIF */
12331235
#else
12341236
/* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
12351237
gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
@@ -1241,12 +1243,51 @@ static int __init arch_setup(void)
12411243
gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
12421244
gpio_request(GPIO_PTY6, NULL); /* write protect */
12431245
gpio_direction_input(GPIO_PTY6);
1244-
gpio_request(GPIO_PTY7, NULL); /* card detect */
1245-
gpio_direction_input(GPIO_PTY7);
12461246

12471247
spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
12481248
#endif
12491249

1250+
/* MMC/SD-card slot CN12 */
1251+
#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
1252+
/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1253+
gpio_request(GPIO_FN_MMC_D7, NULL);
1254+
gpio_request(GPIO_FN_MMC_D6, NULL);
1255+
gpio_request(GPIO_FN_MMC_D5, NULL);
1256+
gpio_request(GPIO_FN_MMC_D4, NULL);
1257+
gpio_request(GPIO_FN_MMC_D3, NULL);
1258+
gpio_request(GPIO_FN_MMC_D2, NULL);
1259+
gpio_request(GPIO_FN_MMC_D1, NULL);
1260+
gpio_request(GPIO_FN_MMC_D0, NULL);
1261+
gpio_request(GPIO_FN_MMC_CLK, NULL);
1262+
gpio_request(GPIO_FN_MMC_CMD, NULL);
1263+
gpio_request(GPIO_PTB7, NULL);
1264+
gpio_direction_output(GPIO_PTB7, 0);
1265+
1266+
cn12_enabled = true;
1267+
#elif defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
1268+
/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1269+
gpio_request(GPIO_FN_SDHI1WP, NULL);
1270+
gpio_request(GPIO_FN_SDHI1CMD, NULL);
1271+
gpio_request(GPIO_FN_SDHI1CLK, NULL);
1272+
gpio_request(GPIO_FN_SDHI1D3, NULL);
1273+
gpio_request(GPIO_FN_SDHI1D2, NULL);
1274+
gpio_request(GPIO_FN_SDHI1D1, NULL);
1275+
gpio_request(GPIO_FN_SDHI1D0, NULL);
1276+
gpio_request(GPIO_PTB7, NULL);
1277+
gpio_direction_output(GPIO_PTB7, 0);
1278+
1279+
/* Card-detect, used on CN12 with SDHI1 */
1280+
gpio_request(GPIO_PTW7, NULL);
1281+
gpio_direction_input(GPIO_PTW7);
1282+
1283+
cn12_enabled = true;
1284+
#endif
1285+
1286+
if (cn12_enabled)
1287+
/* I/O buffer drive ability is high for CN12 */
1288+
__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000,
1289+
IODRIVEA);
1290+
12501291
/* enable Video */
12511292
gpio_request(GPIO_PTU2, NULL);
12521293
gpio_direction_output(GPIO_PTU2, 1);
@@ -1305,25 +1346,6 @@ static int __init arch_setup(void)
13051346
gpio_request(GPIO_PTU5, NULL);
13061347
gpio_direction_output(GPIO_PTU5, 0);
13071348

1308-
#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
1309-
/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1310-
gpio_request(GPIO_FN_MMC_D7, NULL);
1311-
gpio_request(GPIO_FN_MMC_D6, NULL);
1312-
gpio_request(GPIO_FN_MMC_D5, NULL);
1313-
gpio_request(GPIO_FN_MMC_D4, NULL);
1314-
gpio_request(GPIO_FN_MMC_D3, NULL);
1315-
gpio_request(GPIO_FN_MMC_D2, NULL);
1316-
gpio_request(GPIO_FN_MMC_D1, NULL);
1317-
gpio_request(GPIO_FN_MMC_D0, NULL);
1318-
gpio_request(GPIO_FN_MMC_CLK, NULL);
1319-
gpio_request(GPIO_FN_MMC_CMD, NULL);
1320-
gpio_request(GPIO_PTB7, NULL);
1321-
gpio_direction_output(GPIO_PTB7, 0);
1322-
1323-
/* I/O buffer drive ability is high for MMCIF */
1324-
__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1325-
#endif
1326-
13271349
/* enable I2C device */
13281350
i2c_register_board_info(0, i2c0_devices,
13291351
ARRAY_SIZE(i2c0_devices));

‎arch/sh/drivers/dma/dma-g2.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ static int __init g2_dma_init(void)
181181

182182
ret = register_dmac(&g2_dma_info);
183183
if (unlikely(ret != 0))
184-
free_irq(HW_EVENT_G2_DMA, 0);
184+
free_irq(HW_EVENT_G2_DMA, &g2_dma_info);
185185

186186
return ret;
187187
}
188188

189189
static void __exit g2_dma_exit(void)
190190
{
191-
free_irq(HW_EVENT_G2_DMA, 0);
191+
free_irq(HW_EVENT_G2_DMA, &g2_dma_info);
192192
unregister_dmac(&g2_dma_info);
193193
}
194194

‎arch/sh/drivers/dma/dmabrg.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ static int __init dmabrg_init(void)
189189
if (ret == 0)
190190
return ret;
191191

192-
free_irq(DMABRGI1, 0);
193-
out1: free_irq(DMABRGI0, 0);
192+
free_irq(DMABRGI1, NULL);
193+
out1: free_irq(DMABRGI0, NULL);
194194
out0: kfree(dmabrg_handlers);
195195
return ret;
196196
}

‎arch/sh/drivers/pci/pci-sh7780.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
#include <asm/mmu.h>
2222
#include <asm/sizes.h>
2323

24+
#if defined(CONFIG_CPU_BIG_ENDIAN)
25+
# define PCICR_ENDIANNESS SH4_PCICR_BSWP
26+
#else
27+
# define PCICR_ENDIANNESS 0
28+
#endif
29+
30+
2431
static struct resource sh7785_pci_resources[] = {
2532
{
2633
.name = "PCI IO",
@@ -254,7 +261,7 @@ static int __init sh7780_pci_init(void)
254261
__raw_writel(PCIECR_ENBL, PCIECR);
255262

256263
/* Reset */
257-
__raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST,
264+
__raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST | PCICR_ENDIANNESS,
258265
chan->reg_base + SH4_PCICR);
259266

260267
/*
@@ -290,7 +297,8 @@ static int __init sh7780_pci_init(void)
290297
* Now throw it in to register initialization mode and
291298
* start the real work.
292299
*/
293-
__raw_writel(SH4_PCICR_PREFIX, chan->reg_base + SH4_PCICR);
300+
__raw_writel(SH4_PCICR_PREFIX | PCICR_ENDIANNESS,
301+
chan->reg_base + SH4_PCICR);
294302

295303
memphys = __pa(memory_start);
296304
memsize = roundup_pow_of_two(memory_end - memory_start);
@@ -380,7 +388,8 @@ static int __init sh7780_pci_init(void)
380388
* Initialization mode complete, release the control register and
381389
* enable round robin mode to stop device overruns/starvation.
382390
*/
383-
__raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO,
391+
__raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO |
392+
PCICR_ENDIANNESS,
384393
chan->reg_base + SH4_PCICR);
385394

386395
ret = register_pci_controller(chan);

‎arch/sh/include/asm/io.h‎

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define __IO_PREFIX generic
2424
#include <asm/io_generic.h>
2525
#include <asm/io_trapped.h>
26+
#include <mach/mangle-port.h>
2627

2728
#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v))
2829
#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
@@ -34,21 +35,15 @@
3435
#define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a))
3536
#define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a))
3637

37-
#define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; })
38-
#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \
39-
__raw_readw(c)); __v; })
40-
#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \
41-
__raw_readl(c)); __v; })
42-
#define readq_relaxed(c) ({ u64 __v = le64_to_cpu((__force __le64) \
43-
__raw_readq(c)); __v; })
44-
45-
#define writeb_relaxed(v,c) ((void)__raw_writeb(v,c))
46-
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
47-
cpu_to_le16(v),c))
48-
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
49-
cpu_to_le32(v),c))
50-
#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64) \
51-
cpu_to_le64(v),c))
38+
#define readb_relaxed(c) ({ u8 __v = ioswabb(__raw_readb(c)); __v; })
39+
#define readw_relaxed(c) ({ u16 __v = ioswabw(__raw_readw(c)); __v; })
40+
#define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
41+
#define readq_relaxed(c) ({ u64 __v = ioswabq(__raw_readq(c)); __v; })
42+
43+
#define writeb_relaxed(v,c) ((void)__raw_writeb((__force u8)ioswabb(v),c))
44+
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)ioswabw(v),c))
45+
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
46+
#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)ioswabq(v),c))
5247

5348
#define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; })
5449
#define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; })

‎arch/sh/include/asm/unistd.h‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
#ifdef __KERNEL__
22
# ifdef CONFIG_SUPERH32
3+
34
# include "unistd_32.h"
5+
# define __ARCH_WANT_SYS_RT_SIGSUSPEND
6+
47
# else
58
# include "unistd_64.h"
69
# endif
10+
11+
# define __ARCH_WANT_IPC_PARSE_VERSION
12+
# define __ARCH_WANT_OLD_READDIR
13+
# define __ARCH_WANT_OLD_STAT
14+
# define __ARCH_WANT_STAT64
15+
# define __ARCH_WANT_SYS_ALARM
16+
# define __ARCH_WANT_SYS_GETHOSTNAME
17+
# define __ARCH_WANT_SYS_IPC
18+
# define __ARCH_WANT_SYS_PAUSE
19+
# define __ARCH_WANT_SYS_SGETMASK
20+
# define __ARCH_WANT_SYS_SIGNAL
21+
# define __ARCH_WANT_SYS_TIME
22+
# define __ARCH_WANT_SYS_UTIME
23+
# define __ARCH_WANT_SYS_WAITPID
24+
# define __ARCH_WANT_SYS_SOCKETCALL
25+
# define __ARCH_WANT_SYS_FADVISE64
26+
# define __ARCH_WANT_SYS_GETPGRP
27+
# define __ARCH_WANT_SYS_LLSEEK
28+
# define __ARCH_WANT_SYS_NICE
29+
# define __ARCH_WANT_SYS_OLD_GETRLIMIT
30+
# define __ARCH_WANT_SYS_OLD_UNAME
31+
# define __ARCH_WANT_SYS_OLDUMOUNT
32+
# define __ARCH_WANT_SYS_SIGPENDING
33+
# define __ARCH_WANT_SYS_SIGPROCMASK
34+
# define __ARCH_WANT_SYS_RT_SIGACTION
35+
36+
/*
37+
* "Conditional" syscalls
38+
*
39+
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
40+
* but it doesn't work on all toolchains, so we just do it by hand
41+
*/
42+
# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
43+
744
#else
845
# ifdef __SH5__
946
# include "unistd_64.h"

0 commit comments

Comments
 (0)