Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Remove unused SH4-202 support

This early prototype of the SH4 CPU was only used in the "microdev" board
that is now removed, so all of the SH4-202 supoprt can also be removed.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20230914155523.3839811-2-arnd@kernel.org
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

authored by

Arnd Bergmann and committed by
John Paul Adrian Glaubitz
6c329558 3ca64d06

-322
-5
arch/sh/Kconfig
··· 383 383 bool "Support SH7760 processor" 384 384 select CPU_SH4 385 385 386 - config CPU_SUBTYPE_SH4_202 387 - bool "Support SH4-202 processor" 388 - select CPU_SH4 389 - 390 386 # SH-4A Processor Support 391 387 392 388 config CPU_SUBTYPE_SH7723 ··· 513 517 CPU_SUBTYPE_SH7263 || \ 514 518 CPU_SUBTYPE_MXG 515 519 default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R 516 - default "66000000" if CPU_SUBTYPE_SH4_202 517 520 default "50000000" 518 521 help 519 522 This option is used to specify the peripheral clock frequency.
-4
arch/sh/kernel/cpu/sh4/Makefile
··· 23 23 obj-$(CONFIG_CPU_SUBTYPE_SH7751) += setup-sh7750.o 24 24 obj-$(CONFIG_CPU_SUBTYPE_SH7751R) += setup-sh7750.o 25 25 obj-$(CONFIG_CPU_SUBTYPE_SH7760) += setup-sh7760.o 26 - obj-$(CONFIG_CPU_SUBTYPE_SH4_202) += setup-sh4-202.o 27 26 28 27 # Primary on-chip clocks (common) 29 28 ifndef CONFIG_CPU_SH4A 30 29 clock-$(CONFIG_CPU_SH4) := clock-sh4.o 31 30 endif 32 - 33 - # Additional clocks by subtype 34 - clock-$(CONFIG_CPU_SUBTYPE_SH4_202) += clock-sh4-202.o 35 31 36 32 obj-y += $(clock-y) 37 33 obj-$(CONFIG_PERF_EVENTS) += $(perf-y)
-174
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * arch/sh/kernel/cpu/sh4/clock-sh4-202.c 4 - * 5 - * Additional SH4-202 support for the clock framework 6 - * 7 - * Copyright (C) 2005 Paul Mundt 8 - */ 9 - #include <linux/init.h> 10 - #include <linux/kernel.h> 11 - #include <linux/err.h> 12 - #include <linux/io.h> 13 - #include <linux/clkdev.h> 14 - #include <asm/clock.h> 15 - #include <asm/freq.h> 16 - 17 - #define CPG2_FRQCR3 0xfe0a0018 18 - 19 - static int frqcr3_divisors[] = { 1, 2, 3, 4, 6, 8, 16 }; 20 - static int frqcr3_values[] = { 0, 1, 2, 3, 4, 5, 6 }; 21 - 22 - static unsigned long emi_clk_recalc(struct clk *clk) 23 - { 24 - int idx = __raw_readl(CPG2_FRQCR3) & 0x0007; 25 - return clk->parent->rate / frqcr3_divisors[idx]; 26 - } 27 - 28 - static inline int frqcr3_lookup(struct clk *clk, unsigned long rate) 29 - { 30 - int divisor = clk->parent->rate / rate; 31 - int i; 32 - 33 - for (i = 0; i < ARRAY_SIZE(frqcr3_divisors); i++) 34 - if (frqcr3_divisors[i] == divisor) 35 - return frqcr3_values[i]; 36 - 37 - /* Safe fallback */ 38 - return 5; 39 - } 40 - 41 - static struct sh_clk_ops sh4202_emi_clk_ops = { 42 - .recalc = emi_clk_recalc, 43 - }; 44 - 45 - static struct clk sh4202_emi_clk = { 46 - .flags = CLK_ENABLE_ON_INIT, 47 - .ops = &sh4202_emi_clk_ops, 48 - }; 49 - 50 - static unsigned long femi_clk_recalc(struct clk *clk) 51 - { 52 - int idx = (__raw_readl(CPG2_FRQCR3) >> 3) & 0x0007; 53 - return clk->parent->rate / frqcr3_divisors[idx]; 54 - } 55 - 56 - static struct sh_clk_ops sh4202_femi_clk_ops = { 57 - .recalc = femi_clk_recalc, 58 - }; 59 - 60 - static struct clk sh4202_femi_clk = { 61 - .flags = CLK_ENABLE_ON_INIT, 62 - .ops = &sh4202_femi_clk_ops, 63 - }; 64 - 65 - static void shoc_clk_init(struct clk *clk) 66 - { 67 - int i; 68 - 69 - /* 70 - * For some reason, the shoc_clk seems to be set to some really 71 - * insane value at boot (values outside of the allowable frequency 72 - * range for instance). We deal with this by scaling it back down 73 - * to something sensible just in case. 74 - * 75 - * Start scaling from the high end down until we find something 76 - * that passes rate verification.. 77 - */ 78 - for (i = 0; i < ARRAY_SIZE(frqcr3_divisors); i++) { 79 - int divisor = frqcr3_divisors[i]; 80 - 81 - if (clk->ops->set_rate(clk, clk->parent->rate / divisor) == 0) 82 - break; 83 - } 84 - 85 - WARN_ON(i == ARRAY_SIZE(frqcr3_divisors)); /* Undefined clock */ 86 - } 87 - 88 - static unsigned long shoc_clk_recalc(struct clk *clk) 89 - { 90 - int idx = (__raw_readl(CPG2_FRQCR3) >> 6) & 0x0007; 91 - return clk->parent->rate / frqcr3_divisors[idx]; 92 - } 93 - 94 - static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate) 95 - { 96 - struct clk *bclk = clk_get(NULL, "bus_clk"); 97 - unsigned long bclk_rate = clk_get_rate(bclk); 98 - 99 - clk_put(bclk); 100 - 101 - if (rate > bclk_rate) 102 - return 1; 103 - if (rate > 66000000) 104 - return 1; 105 - 106 - return 0; 107 - } 108 - 109 - static int shoc_clk_set_rate(struct clk *clk, unsigned long rate) 110 - { 111 - unsigned long frqcr3; 112 - unsigned int tmp; 113 - 114 - /* Make sure we have something sensible to switch to */ 115 - if (shoc_clk_verify_rate(clk, rate) != 0) 116 - return -EINVAL; 117 - 118 - tmp = frqcr3_lookup(clk, rate); 119 - 120 - frqcr3 = __raw_readl(CPG2_FRQCR3); 121 - frqcr3 &= ~(0x0007 << 6); 122 - frqcr3 |= tmp << 6; 123 - __raw_writel(frqcr3, CPG2_FRQCR3); 124 - 125 - clk->rate = clk->parent->rate / frqcr3_divisors[tmp]; 126 - 127 - return 0; 128 - } 129 - 130 - static struct sh_clk_ops sh4202_shoc_clk_ops = { 131 - .init = shoc_clk_init, 132 - .recalc = shoc_clk_recalc, 133 - .set_rate = shoc_clk_set_rate, 134 - }; 135 - 136 - static struct clk sh4202_shoc_clk = { 137 - .flags = CLK_ENABLE_ON_INIT, 138 - .ops = &sh4202_shoc_clk_ops, 139 - }; 140 - 141 - static struct clk *sh4202_onchip_clocks[] = { 142 - &sh4202_emi_clk, 143 - &sh4202_femi_clk, 144 - &sh4202_shoc_clk, 145 - }; 146 - 147 - static struct clk_lookup lookups[] = { 148 - /* main clocks */ 149 - CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk), 150 - CLKDEV_CON_ID("femi_clk", &sh4202_femi_clk), 151 - CLKDEV_CON_ID("shoc_clk", &sh4202_shoc_clk), 152 - }; 153 - 154 - int __init arch_clk_init(void) 155 - { 156 - struct clk *clk; 157 - int i, ret = 0; 158 - 159 - cpg_clk_init(); 160 - 161 - clk = clk_get(NULL, "master_clk"); 162 - for (i = 0; i < ARRAY_SIZE(sh4202_onchip_clocks); i++) { 163 - struct clk *clkp = sh4202_onchip_clocks[i]; 164 - 165 - clkp->parent = clk; 166 - ret |= clk_register(clkp); 167 - } 168 - 169 - clk_put(clk); 170 - 171 - clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 172 - 173 - return ret; 174 - }
-139
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * SH4-202 Setup 4 - * 5 - * Copyright (C) 2006 Paul Mundt 6 - * Copyright (C) 2009 Magnus Damm 7 - */ 8 - #include <linux/platform_device.h> 9 - #include <linux/init.h> 10 - #include <linux/serial.h> 11 - #include <linux/serial_sci.h> 12 - #include <linux/sh_timer.h> 13 - #include <linux/sh_intc.h> 14 - #include <linux/io.h> 15 - #include <asm/platform_early.h> 16 - 17 - static struct plat_sci_port scif0_platform_data = { 18 - .scscr = SCSCR_REIE, 19 - .type = PORT_SCIF, 20 - }; 21 - 22 - static struct resource scif0_resources[] = { 23 - DEFINE_RES_MEM(0xffe80000, 0x100), 24 - DEFINE_RES_IRQ(evt2irq(0x700)), 25 - DEFINE_RES_IRQ(evt2irq(0x720)), 26 - DEFINE_RES_IRQ(evt2irq(0x760)), 27 - DEFINE_RES_IRQ(evt2irq(0x740)), 28 - }; 29 - 30 - static struct platform_device scif0_device = { 31 - .name = "sh-sci", 32 - .id = 0, 33 - .resource = scif0_resources, 34 - .num_resources = ARRAY_SIZE(scif0_resources), 35 - .dev = { 36 - .platform_data = &scif0_platform_data, 37 - }, 38 - }; 39 - 40 - static struct sh_timer_config tmu0_platform_data = { 41 - .channels_mask = 7, 42 - }; 43 - 44 - static struct resource tmu0_resources[] = { 45 - DEFINE_RES_MEM(0xffd80000, 0x30), 46 - DEFINE_RES_IRQ(evt2irq(0x400)), 47 - DEFINE_RES_IRQ(evt2irq(0x420)), 48 - DEFINE_RES_IRQ(evt2irq(0x440)), 49 - }; 50 - 51 - static struct platform_device tmu0_device = { 52 - .name = "sh-tmu", 53 - .id = 0, 54 - .dev = { 55 - .platform_data = &tmu0_platform_data, 56 - }, 57 - .resource = tmu0_resources, 58 - .num_resources = ARRAY_SIZE(tmu0_resources), 59 - }; 60 - 61 - static struct platform_device *sh4202_devices[] __initdata = { 62 - &scif0_device, 63 - &tmu0_device, 64 - }; 65 - 66 - static int __init sh4202_devices_setup(void) 67 - { 68 - return platform_add_devices(sh4202_devices, 69 - ARRAY_SIZE(sh4202_devices)); 70 - } 71 - arch_initcall(sh4202_devices_setup); 72 - 73 - static struct platform_device *sh4202_early_devices[] __initdata = { 74 - &scif0_device, 75 - &tmu0_device, 76 - }; 77 - 78 - void __init plat_early_device_setup(void) 79 - { 80 - sh_early_platform_add_devices(sh4202_early_devices, 81 - ARRAY_SIZE(sh4202_early_devices)); 82 - } 83 - 84 - enum { 85 - UNUSED = 0, 86 - 87 - /* interrupt sources */ 88 - IRL0, IRL1, IRL2, IRL3, /* only IRLM mode supported */ 89 - HUDI, TMU0, TMU1, TMU2, RTC, SCIF, WDT, 90 - }; 91 - 92 - static struct intc_vect vectors[] __initdata = { 93 - INTC_VECT(HUDI, 0x600), 94 - INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), 95 - INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460), 96 - INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0), 97 - INTC_VECT(RTC, 0x4c0), 98 - INTC_VECT(SCIF, 0x700), INTC_VECT(SCIF, 0x720), 99 - INTC_VECT(SCIF, 0x740), INTC_VECT(SCIF, 0x760), 100 - INTC_VECT(WDT, 0x560), 101 - }; 102 - 103 - static struct intc_prio_reg prio_registers[] __initdata = { 104 - { 0xffd00004, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } }, 105 - { 0xffd00008, 0, 16, 4, /* IPRB */ { WDT, 0, 0, 0 } }, 106 - { 0xffd0000c, 0, 16, 4, /* IPRC */ { 0, 0, SCIF, HUDI } }, 107 - { 0xffd00010, 0, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } }, 108 - }; 109 - 110 - static DECLARE_INTC_DESC(intc_desc, "sh4-202", vectors, NULL, 111 - NULL, prio_registers, NULL); 112 - 113 - static struct intc_vect vectors_irlm[] __initdata = { 114 - INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0), 115 - INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360), 116 - }; 117 - 118 - static DECLARE_INTC_DESC(intc_desc_irlm, "sh4-202_irlm", vectors_irlm, NULL, 119 - NULL, prio_registers, NULL); 120 - 121 - void __init plat_irq_setup(void) 122 - { 123 - register_intc_controller(&intc_desc); 124 - } 125 - 126 - #define INTC_ICR 0xffd00000UL 127 - #define INTC_ICR_IRLM (1<<7) 128 - 129 - void __init plat_irq_setup_pins(int mode) 130 - { 131 - switch (mode) { 132 - case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */ 133 - __raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR); 134 - register_intc_controller(&intc_desc_irlm); 135 - break; 136 - default: 137 - BUG(); 138 - } 139 - }