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

sh: Remove superhyway bus support

The superhyway bus driver was only referenced on SH4-202, which is now gone,
so remove it all as well.

I could find no trace of anything ever calling superhyway_register_driver(),
not in the git history but also not on the web, so I assume this has never
served any purpose on mainline kernels.

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-3-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
8daaed76 6c329558

-590
-6
Documentation/arch/sh/index.rst
··· 43 43 Busses 44 44 ====== 45 45 46 - SuperHyway 47 - ---------- 48 - 49 - .. kernel-doc:: drivers/sh/superhyway/superhyway.c 50 - :export: 51 - 52 46 Maple 53 47 ----- 54 48
-4
arch/sh/Kconfig
··· 737 737 738 738 menu "Bus options" 739 739 740 - config SUPERHYWAY 741 - tristate "SuperHyway Bus support" 742 - depends on CPU_SUBTYPE_SH4_202 743 - 744 740 config MAPLE 745 741 bool "Maple Bus support" 746 742 depends on SH_DREAMCAST
-1
arch/sh/drivers/Makefile
··· 6 6 obj-y += dma/ platform_early.o 7 7 8 8 obj-$(CONFIG_PCI) += pci/ 9 - obj-$(CONFIG_SUPERHYWAY) += superhyway/ 10 9 obj-$(CONFIG_PUSH_SWITCH) += push-switch.o 11 10 obj-$(CONFIG_HEARTBEAT) += heartbeat.o
-7
arch/sh/drivers/superhyway/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # Makefile for the SuperHyway specific kernel interface routines under Linux. 4 - # 5 - 6 - obj-$(CONFIG_CPU_SUBTYPE_SH4_202) += ops-sh4-202.o 7 -
-168
arch/sh/drivers/superhyway/ops-sh4-202.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * arch/sh/drivers/superhyway/ops-sh4-202.c 4 - * 5 - * SuperHyway bus support for SH4-202 6 - * 7 - * Copyright (C) 2005 Paul Mundt 8 - */ 9 - #include <linux/kernel.h> 10 - #include <linux/init.h> 11 - #include <linux/superhyway.h> 12 - #include <linux/string.h> 13 - #include <asm/addrspace.h> 14 - #include <asm/io.h> 15 - 16 - #define PHYS_EMI_CBLOCK P4SEGADDR(0x1ec00000) 17 - #define PHYS_EMI_DBLOCK P4SEGADDR(0x08000000) 18 - #define PHYS_FEMI_CBLOCK P4SEGADDR(0x1f800000) 19 - #define PHYS_FEMI_DBLOCK P4SEGADDR(0x00000000) 20 - 21 - #define PHYS_EPBR_BLOCK P4SEGADDR(0x1de00000) 22 - #define PHYS_DMAC_BLOCK P4SEGADDR(0x1fa00000) 23 - #define PHYS_PBR_BLOCK P4SEGADDR(0x1fc00000) 24 - 25 - static struct resource emi_resources[] = { 26 - [0] = { 27 - .start = PHYS_EMI_CBLOCK, 28 - .end = PHYS_EMI_CBLOCK + 0x00300000 - 1, 29 - .flags = IORESOURCE_MEM, 30 - }, 31 - [1] = { 32 - .start = PHYS_EMI_DBLOCK, 33 - .end = PHYS_EMI_DBLOCK + 0x08000000 - 1, 34 - .flags = IORESOURCE_MEM, 35 - }, 36 - }; 37 - 38 - static struct superhyway_device emi_device = { 39 - .name = "emi", 40 - .num_resources = ARRAY_SIZE(emi_resources), 41 - .resource = emi_resources, 42 - }; 43 - 44 - static struct resource femi_resources[] = { 45 - [0] = { 46 - .start = PHYS_FEMI_CBLOCK, 47 - .end = PHYS_FEMI_CBLOCK + 0x00100000 - 1, 48 - .flags = IORESOURCE_MEM, 49 - }, 50 - [1] = { 51 - .start = PHYS_FEMI_DBLOCK, 52 - .end = PHYS_FEMI_DBLOCK + 0x08000000 - 1, 53 - .flags = IORESOURCE_MEM, 54 - }, 55 - }; 56 - 57 - static struct superhyway_device femi_device = { 58 - .name = "femi", 59 - .num_resources = ARRAY_SIZE(femi_resources), 60 - .resource = femi_resources, 61 - }; 62 - 63 - static struct resource epbr_resources[] = { 64 - [0] = { 65 - .start = P4SEGADDR(0x1e7ffff8), 66 - .end = P4SEGADDR(0x1e7ffff8 + (sizeof(u32) * 2) - 1), 67 - .flags = IORESOURCE_MEM, 68 - }, 69 - [1] = { 70 - .start = PHYS_EPBR_BLOCK, 71 - .end = PHYS_EPBR_BLOCK + 0x00a00000 - 1, 72 - .flags = IORESOURCE_MEM, 73 - }, 74 - }; 75 - 76 - static struct superhyway_device epbr_device = { 77 - .name = "epbr", 78 - .num_resources = ARRAY_SIZE(epbr_resources), 79 - .resource = epbr_resources, 80 - }; 81 - 82 - static struct resource dmac_resource = { 83 - .start = PHYS_DMAC_BLOCK, 84 - .end = PHYS_DMAC_BLOCK + 0x00100000 - 1, 85 - .flags = IORESOURCE_MEM, 86 - }; 87 - 88 - static struct superhyway_device dmac_device = { 89 - .name = "dmac", 90 - .num_resources = 1, 91 - .resource = &dmac_resource, 92 - }; 93 - 94 - static struct resource pbr_resources[] = { 95 - [0] = { 96 - .start = P4SEGADDR(0x1ffffff8), 97 - .end = P4SEGADDR(0x1ffffff8 + (sizeof(u32) * 2) - 1), 98 - .flags = IORESOURCE_MEM, 99 - }, 100 - [1] = { 101 - .start = PHYS_PBR_BLOCK, 102 - .end = PHYS_PBR_BLOCK + 0x00400000 - (sizeof(u32) * 2) - 1, 103 - .flags = IORESOURCE_MEM, 104 - }, 105 - }; 106 - 107 - static struct superhyway_device pbr_device = { 108 - .name = "pbr", 109 - .num_resources = ARRAY_SIZE(pbr_resources), 110 - .resource = pbr_resources, 111 - }; 112 - 113 - static struct superhyway_device *sh4202_devices[] __initdata = { 114 - &emi_device, &femi_device, &epbr_device, &dmac_device, &pbr_device, 115 - }; 116 - 117 - static int sh4202_read_vcr(unsigned long base, struct superhyway_vcr_info *vcr) 118 - { 119 - u32 vcrh, vcrl; 120 - u64 tmp; 121 - 122 - /* 123 - * XXX: Even though the SH4-202 Evaluation Device documentation 124 - * indicates that VCRL is mapped first with VCRH at a + 0x04 125 - * offset, the opposite seems to be true. 126 - * 127 - * Some modules (PBR and ePBR for instance) also appear to have 128 - * VCRL/VCRH flipped in the documentation, but on the SH4-202 129 - * itself it appears that these are all consistently mapped with 130 - * VCRH preceding VCRL. 131 - * 132 - * Do not trust the documentation, for it is evil. 133 - */ 134 - vcrh = __raw_readl(base); 135 - vcrl = __raw_readl(base + sizeof(u32)); 136 - 137 - tmp = ((u64)vcrh << 32) | vcrl; 138 - memcpy(vcr, &tmp, sizeof(u64)); 139 - 140 - return 0; 141 - } 142 - 143 - static int sh4202_write_vcr(unsigned long base, struct superhyway_vcr_info vcr) 144 - { 145 - u64 tmp = *(u64 *)&vcr; 146 - 147 - __raw_writel((tmp >> 32) & 0xffffffff, base); 148 - __raw_writel(tmp & 0xffffffff, base + sizeof(u32)); 149 - 150 - return 0; 151 - } 152 - 153 - static struct superhyway_ops sh4202_superhyway_ops = { 154 - .read_vcr = sh4202_read_vcr, 155 - .write_vcr = sh4202_write_vcr, 156 - }; 157 - 158 - struct superhyway_bus superhyway_channels[] = { 159 - { &sh4202_superhyway_ops, }, 160 - { 0, }, 161 - }; 162 - 163 - int __init superhyway_scan_bus(struct superhyway_bus *bus) 164 - { 165 - return superhyway_add_devices(bus, sh4202_devices, 166 - ARRAY_SIZE(sh4202_devices)); 167 - } 168 -
-1
drivers/sh/Makefile
··· 7 7 obj-$(CONFIG_HAVE_CLK) += clk/ 8 8 endif 9 9 obj-$(CONFIG_MAPLE) += maple/ 10 - obj-$(CONFIG_SUPERHYWAY) += superhyway/ 11 10 12 11 obj-y += pm_runtime.o
-8
drivers/sh/superhyway/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for the SuperHyway bus drivers. 4 - # 5 - 6 - obj-$(CONFIG_SUPERHYWAY) += superhyway.o 7 - obj-$(CONFIG_SYSFS) += superhyway-sysfs.o 8 -
-54
drivers/sh/superhyway/superhyway-sysfs.c
··· 1 - /* 2 - * drivers/sh/superhyway/superhyway-sysfs.c 3 - * 4 - * SuperHyway Bus sysfs interface 5 - * 6 - * Copyright (C) 2004, 2005 Paul Mundt <lethal@linux-sh.org> 7 - * 8 - * This file is subject to the terms and conditions of the GNU General Public 9 - * License. See the file "COPYING" in the main directory of this archive 10 - * for more details. 11 - */ 12 - #include <linux/kernel.h> 13 - #include <linux/device.h> 14 - #include <linux/types.h> 15 - #include <linux/superhyway.h> 16 - 17 - #define superhyway_ro_attr(name, fmt, field) \ 18 - static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \ 19 - { \ 20 - struct superhyway_device *s = to_superhyway_device(dev); \ 21 - return sprintf(buf, fmt, s->field); \ 22 - } \ 23 - static DEVICE_ATTR_RO(name); 24 - 25 - /* VCR flags */ 26 - superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags); 27 - superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags); 28 - superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers); 29 - superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id); 30 - superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb); 31 - superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb); 32 - 33 - /* Misc */ 34 - superhyway_ro_attr(resource, "0x%08lx\n", resource[0].start); 35 - 36 - static struct attribute *superhyway_dev_attrs[] = { 37 - &dev_attr_perr_flags.attr, 38 - &dev_attr_merr_flags.attr, 39 - &dev_attr_mod_vers.attr, 40 - &dev_attr_mod_id.attr, 41 - &dev_attr_bot_mb.attr, 42 - &dev_attr_top_mb.attr, 43 - &dev_attr_resource.attr, 44 - NULL, 45 - }; 46 - 47 - static const struct attribute_group superhyway_dev_group = { 48 - .attrs = superhyway_dev_attrs, 49 - }; 50 - 51 - const struct attribute_group *superhyway_dev_groups[] = { 52 - &superhyway_dev_group, 53 - NULL, 54 - };
-234
drivers/sh/superhyway/superhyway.c
··· 1 - /* 2 - * drivers/sh/superhyway/superhyway.c 3 - * 4 - * SuperHyway Bus Driver 5 - * 6 - * Copyright (C) 2004, 2005 Paul Mundt <lethal@linux-sh.org> 7 - * 8 - * This file is subject to the terms and conditions of the GNU General Public 9 - * License. See the file "COPYING" in the main directory of this archive 10 - * for more details. 11 - */ 12 - #include <linux/kernel.h> 13 - #include <linux/device.h> 14 - #include <linux/init.h> 15 - #include <linux/module.h> 16 - #include <linux/types.h> 17 - #include <linux/list.h> 18 - #include <linux/superhyway.h> 19 - #include <linux/string.h> 20 - #include <linux/slab.h> 21 - 22 - static int superhyway_devices; 23 - 24 - static struct device superhyway_bus_device = { 25 - .init_name = "superhyway", 26 - }; 27 - 28 - static void superhyway_device_release(struct device *dev) 29 - { 30 - struct superhyway_device *sdev = to_superhyway_device(dev); 31 - 32 - kfree(sdev->resource); 33 - kfree(sdev); 34 - } 35 - 36 - /** 37 - * superhyway_add_device - Add a SuperHyway module 38 - * @base: Physical address where module is mapped. 39 - * @sdev: SuperHyway device to add, or NULL to allocate a new one. 40 - * @bus: Bus where SuperHyway module resides. 41 - * 42 - * This is responsible for adding a new SuperHyway module. This sets up a new 43 - * struct superhyway_device for the module being added if @sdev == NULL. 44 - * 45 - * Devices are initially added in the order that they are scanned (from the 46 - * top-down of the memory map), and are assigned an ID based on the order that 47 - * they are added. Any manual addition of a module will thus get the ID after 48 - * the devices already discovered regardless of where it resides in memory. 49 - * 50 - * Further work can and should be done in superhyway_scan_bus(), to be sure 51 - * that any new modules are properly discovered and subsequently registered. 52 - */ 53 - int superhyway_add_device(unsigned long base, struct superhyway_device *sdev, 54 - struct superhyway_bus *bus) 55 - { 56 - struct superhyway_device *dev = sdev; 57 - 58 - if (!dev) { 59 - dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL); 60 - if (!dev) 61 - return -ENOMEM; 62 - 63 - } 64 - 65 - dev->bus = bus; 66 - superhyway_read_vcr(dev, base, &dev->vcr); 67 - 68 - if (!dev->resource) { 69 - dev->resource = kzalloc(sizeof(struct resource), GFP_KERNEL); 70 - if (!dev->resource) { 71 - kfree(dev); 72 - return -ENOMEM; 73 - } 74 - 75 - dev->resource->name = dev->name; 76 - dev->resource->start = base; 77 - dev->resource->end = dev->resource->start + 0x01000000; 78 - } 79 - 80 - dev->dev.parent = &superhyway_bus_device; 81 - dev->dev.bus = &superhyway_bus_type; 82 - dev->dev.release = superhyway_device_release; 83 - dev->id.id = dev->vcr.mod_id; 84 - 85 - sprintf(dev->name, "SuperHyway device %04x", dev->id.id); 86 - dev_set_name(&dev->dev, "%02x", superhyway_devices); 87 - 88 - superhyway_devices++; 89 - 90 - return device_register(&dev->dev); 91 - } 92 - 93 - int superhyway_add_devices(struct superhyway_bus *bus, 94 - struct superhyway_device **devices, 95 - int nr_devices) 96 - { 97 - int i, ret = 0; 98 - 99 - for (i = 0; i < nr_devices; i++) { 100 - struct superhyway_device *dev = devices[i]; 101 - ret |= superhyway_add_device(dev->resource[0].start, dev, bus); 102 - } 103 - 104 - return ret; 105 - } 106 - 107 - static int __init superhyway_init(void) 108 - { 109 - struct superhyway_bus *bus; 110 - int ret; 111 - 112 - ret = device_register(&superhyway_bus_device); 113 - if (unlikely(ret)) 114 - return ret; 115 - 116 - for (bus = superhyway_channels; bus->ops; bus++) 117 - ret |= superhyway_scan_bus(bus); 118 - 119 - return ret; 120 - } 121 - postcore_initcall(superhyway_init); 122 - 123 - static const struct superhyway_device_id * 124 - superhyway_match_id(const struct superhyway_device_id *ids, 125 - struct superhyway_device *dev) 126 - { 127 - while (ids->id) { 128 - if (ids->id == dev->id.id) 129 - return ids; 130 - 131 - ids++; 132 - } 133 - 134 - return NULL; 135 - } 136 - 137 - static int superhyway_device_probe(struct device *dev) 138 - { 139 - struct superhyway_device *shyway_dev = to_superhyway_device(dev); 140 - struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); 141 - 142 - if (shyway_drv && shyway_drv->probe) { 143 - const struct superhyway_device_id *id; 144 - 145 - id = superhyway_match_id(shyway_drv->id_table, shyway_dev); 146 - if (id) 147 - return shyway_drv->probe(shyway_dev, id); 148 - } 149 - 150 - return -ENODEV; 151 - } 152 - 153 - static void superhyway_device_remove(struct device *dev) 154 - { 155 - struct superhyway_device *shyway_dev = to_superhyway_device(dev); 156 - struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); 157 - 158 - if (shyway_drv->remove) 159 - shyway_drv->remove(shyway_dev); 160 - } 161 - 162 - /** 163 - * superhyway_register_driver - Register a new SuperHyway driver 164 - * @drv: SuperHyway driver to register. 165 - * 166 - * This registers the passed in @drv. Any devices matching the id table will 167 - * automatically be populated and handed off to the driver's specified probe 168 - * routine. 169 - */ 170 - int superhyway_register_driver(struct superhyway_driver *drv) 171 - { 172 - drv->drv.name = drv->name; 173 - drv->drv.bus = &superhyway_bus_type; 174 - 175 - return driver_register(&drv->drv); 176 - } 177 - 178 - /** 179 - * superhyway_unregister_driver - Unregister a SuperHyway driver 180 - * @drv: SuperHyway driver to unregister. 181 - * 182 - * This cleans up after superhyway_register_driver(), and should be invoked in 183 - * the exit path of any module drivers. 184 - */ 185 - void superhyway_unregister_driver(struct superhyway_driver *drv) 186 - { 187 - driver_unregister(&drv->drv); 188 - } 189 - 190 - static int superhyway_bus_match(struct device *dev, struct device_driver *drv) 191 - { 192 - struct superhyway_device *shyway_dev = to_superhyway_device(dev); 193 - struct superhyway_driver *shyway_drv = to_superhyway_driver(drv); 194 - const struct superhyway_device_id *ids = shyway_drv->id_table; 195 - 196 - if (!ids) 197 - return -EINVAL; 198 - if (superhyway_match_id(ids, shyway_dev)) 199 - return 1; 200 - 201 - return -ENODEV; 202 - } 203 - 204 - struct bus_type superhyway_bus_type = { 205 - .name = "superhyway", 206 - .match = superhyway_bus_match, 207 - #ifdef CONFIG_SYSFS 208 - .dev_groups = superhyway_dev_groups, 209 - #endif 210 - .probe = superhyway_device_probe, 211 - .remove = superhyway_device_remove, 212 - }; 213 - 214 - static int __init superhyway_bus_init(void) 215 - { 216 - return bus_register(&superhyway_bus_type); 217 - } 218 - 219 - static void __exit superhyway_bus_exit(void) 220 - { 221 - device_unregister(&superhyway_bus_device); 222 - bus_unregister(&superhyway_bus_type); 223 - } 224 - 225 - core_initcall(superhyway_bus_init); 226 - module_exit(superhyway_bus_exit); 227 - 228 - EXPORT_SYMBOL(superhyway_bus_type); 229 - EXPORT_SYMBOL(superhyway_add_device); 230 - EXPORT_SYMBOL(superhyway_add_devices); 231 - EXPORT_SYMBOL(superhyway_register_driver); 232 - EXPORT_SYMBOL(superhyway_unregister_driver); 233 - 234 - MODULE_LICENSE("GPL");
-107
include/linux/superhyway.h
··· 1 - /* 2 - * include/linux/superhyway.h 3 - * 4 - * SuperHyway Bus definitions 5 - * 6 - * Copyright (C) 2004, 2005 Paul Mundt <lethal@linux-sh.org> 7 - * 8 - * This file is subject to the terms and conditions of the GNU General Public 9 - * License. See the file "COPYING" in the main directory of this archive 10 - * for more details. 11 - */ 12 - #ifndef __LINUX_SUPERHYWAY_H 13 - #define __LINUX_SUPERHYWAY_H 14 - 15 - #include <linux/device.h> 16 - 17 - /* 18 - * SuperHyway IDs 19 - */ 20 - #define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183 21 - 22 - struct superhyway_vcr_info { 23 - u8 perr_flags; /* P-port Error flags */ 24 - u8 merr_flags; /* Module Error flags */ 25 - u16 mod_vers; /* Module Version */ 26 - u16 mod_id; /* Module ID */ 27 - u8 bot_mb; /* Bottom Memory block */ 28 - u8 top_mb; /* Top Memory block */ 29 - }; 30 - 31 - struct superhyway_ops { 32 - int (*read_vcr)(unsigned long base, struct superhyway_vcr_info *vcr); 33 - int (*write_vcr)(unsigned long base, struct superhyway_vcr_info vcr); 34 - }; 35 - 36 - struct superhyway_bus { 37 - struct superhyway_ops *ops; 38 - }; 39 - 40 - extern struct superhyway_bus superhyway_channels[]; 41 - 42 - struct superhyway_device_id { 43 - unsigned int id; 44 - unsigned long driver_data; 45 - }; 46 - 47 - struct superhyway_device; 48 - extern struct bus_type superhyway_bus_type; 49 - 50 - struct superhyway_driver { 51 - char *name; 52 - 53 - const struct superhyway_device_id *id_table; 54 - struct device_driver drv; 55 - 56 - int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id); 57 - void (*remove)(struct superhyway_device *dev); 58 - }; 59 - 60 - #define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv) 61 - 62 - struct superhyway_device { 63 - char name[32]; 64 - 65 - struct device dev; 66 - 67 - struct superhyway_device_id id; 68 - struct superhyway_driver *drv; 69 - struct superhyway_bus *bus; 70 - 71 - int num_resources; 72 - struct resource *resource; 73 - struct superhyway_vcr_info vcr; 74 - }; 75 - 76 - #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev) 77 - 78 - #define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev) 79 - #define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) 80 - 81 - static inline int 82 - superhyway_read_vcr(struct superhyway_device *dev, unsigned long base, 83 - struct superhyway_vcr_info *vcr) 84 - { 85 - return dev->bus->ops->read_vcr(base, vcr); 86 - } 87 - 88 - static inline int 89 - superhyway_write_vcr(struct superhyway_device *dev, unsigned long base, 90 - struct superhyway_vcr_info vcr) 91 - { 92 - return dev->bus->ops->write_vcr(base, vcr); 93 - } 94 - 95 - extern int superhyway_scan_bus(struct superhyway_bus *); 96 - 97 - /* drivers/sh/superhyway/superhyway.c */ 98 - int superhyway_register_driver(struct superhyway_driver *); 99 - void superhyway_unregister_driver(struct superhyway_driver *); 100 - int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *); 101 - int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices); 102 - 103 - /* drivers/sh/superhyway/superhyway-sysfs.c */ 104 - extern const struct attribute_group *superhyway_dev_groups[]; 105 - 106 - #endif /* __LINUX_SUPERHYWAY_H */ 107 -