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

ARM: Orion: Get address map from plat-orion instead of via platform_data

Use an getter function in plat-orion/addr-map.c to get the address map
structure, rather than pass it to drivers in the platform_data
structures. When the drivers are built for none orion platforms, a
dummy function is provided instead which returns NULL.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Michael Walle <michael@walle.cc>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>

authored by

Andrew Lunn and committed by
Nicolas Pitre
63a9332b 45173d5e

+73 -48
+1 -2
arch/arm/mach-dove/pcie.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/pci.h> 13 - #include <linux/mbus.h> 14 13 #include <video/vga.h> 15 14 #include <asm/mach/pci.h> 16 15 #include <asm/mach/arch.h> ··· 50 51 */ 51 52 orion_pcie_set_local_bus_nr(pp->base, sys->busnr); 52 53 53 - orion_pcie_setup(pp->base, &orion_mbus_dram_info); 54 + orion_pcie_setup(pp->base); 54 55 55 56 /* 56 57 * IORESOURCE_IO
-1
arch/arm/mach-kirkwood/mpp.c
··· 10 10 #include <linux/gpio.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 - #include <linux/mbus.h> 14 13 #include <linux/io.h> 15 14 #include <mach/hardware.h> 16 15 #include <plat/mpp.h>
+1 -2
arch/arm/mach-kirkwood/pcie.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/pci.h> 13 13 #include <linux/slab.h> 14 - #include <linux/mbus.h> 15 14 #include <video/vga.h> 16 15 #include <asm/irq.h> 17 16 #include <asm/mach/pci.h> ··· 208 209 */ 209 210 orion_pcie_set_local_bus_nr(pp->base, sys->busnr); 210 211 211 - orion_pcie_setup(pp->base, &orion_mbus_dram_info); 212 + orion_pcie_setup(pp->base); 212 213 213 214 return 1; 214 215 }
-1
arch/arm/mach-mv78xx0/mpp.c
··· 10 10 #include <linux/gpio.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 - #include <linux/mbus.h> 14 13 #include <linux/io.h> 15 14 #include <plat/mpp.h> 16 15 #include <mach/hardware.h>
+1 -2
arch/arm/mach-mv78xx0/pcie.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/pci.h> 13 - #include <linux/mbus.h> 14 13 #include <video/vga.h> 15 14 #include <asm/irq.h> 16 15 #include <asm/mach/pci.h> ··· 153 154 * Generic PCIe unit setup. 154 155 */ 155 156 orion_pcie_set_local_bus_nr(pp->base, sys->busnr); 156 - orion_pcie_setup(pp->base, &orion_mbus_dram_info); 157 + orion_pcie_setup(pp->base); 157 158 158 159 sys->resource[0] = &pp->res[0]; 159 160 sys->resource[1] = &pp->res[1];
-1
arch/arm/mach-orion5x/mpp.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 - #include <linux/mbus.h> 14 13 #include <linux/io.h> 15 14 #include <mach/hardware.h> 16 15 #include <plat/mpp.h>
+1 -1
arch/arm/mach-orion5x/pci.c
··· 146 146 /* 147 147 * Generic PCIe unit setup. 148 148 */ 149 - orion_pcie_setup(PCIE_BASE, &orion_mbus_dram_info); 149 + orion_pcie_setup(PCIE_BASE); 150 150 151 151 /* 152 152 * Check whether to apply Orion-1/Orion-NAS PCIe config
+7
arch/arm/plat-orion/addr-map.c
··· 9 9 */ 10 10 11 11 #include <linux/kernel.h> 12 + #include <linux/module.h> 12 13 #include <linux/init.h> 13 14 #include <linux/mbus.h> 14 15 #include <linux/io.h> 15 16 #include <plat/addr-map.h> 16 17 17 18 struct mbus_dram_target_info orion_mbus_dram_info; 19 + 20 + const struct mbus_dram_target_info *mv_mbus_dram_info(void) 21 + { 22 + return &orion_mbus_dram_info; 23 + } 24 + EXPORT_SYMBOL_GPL(mv_mbus_dram_info); 18 25 19 26 /* 20 27 * DDR target is the same on all Orion platforms.
+1 -2
arch/arm/plat-orion/include/plat/pcie.h
··· 20 20 int orion_pcie_get_local_bus_nr(void __iomem *base); 21 21 void orion_pcie_set_local_bus_nr(void __iomem *base, int nr); 22 22 void orion_pcie_reset(void __iomem *base); 23 - void orion_pcie_setup(void __iomem *base, 24 - struct mbus_dram_target_info *dram); 23 + void orion_pcie_setup(void __iomem *base); 25 24 int orion_pcie_rd_conf(void __iomem *base, struct pci_bus *bus, 26 25 u32 devfn, int where, int size, u32 *val); 27 26 int orion_pcie_rd_conf_tlp(void __iomem *base, struct pci_bus *bus,
+3 -3
arch/arm/plat-orion/pcie.c
··· 13 13 #include <linux/mbus.h> 14 14 #include <asm/mach/pci.h> 15 15 #include <plat/pcie.h> 16 + #include <plat/addr-map.h> 16 17 #include <linux/delay.h> 17 18 18 19 /* ··· 176 175 writel(((size - 1) & 0xffff0000) | 1, base + PCIE_BAR_CTRL_OFF(1)); 177 176 } 178 177 179 - void __init orion_pcie_setup(void __iomem *base, 180 - struct mbus_dram_target_info *dram) 178 + void __init orion_pcie_setup(void __iomem *base) 181 179 { 182 180 u16 cmd; 183 181 u32 mask; ··· 184 184 /* 185 185 * Point PCIe unit MBUS decode windows to DRAM space. 186 186 */ 187 - orion_pcie_setup_wins(base, dram); 187 + orion_pcie_setup_wins(base, &orion_mbus_dram_info); 188 188 189 189 /* 190 190 * Master + slave enable.
+11 -8
drivers/ata/sata_mv.c
··· 3988 3988 } 3989 3989 3990 3990 static void mv_conf_mbus_windows(struct mv_host_priv *hpriv, 3991 - struct mbus_dram_target_info *dram) 3991 + const struct mbus_dram_target_info *dram) 3992 3992 { 3993 3993 int i; 3994 3994 ··· 3998 3998 } 3999 3999 4000 4000 for (i = 0; i < dram->num_cs; i++) { 4001 - struct mbus_dram_window *cs = dram->cs + i; 4001 + const struct mbus_dram_window *cs = dram->cs + i; 4002 4002 4003 4003 writel(((cs->size - 1) & 0xffff0000) | 4004 4004 (cs->mbus_attr << 8) | ··· 4019 4019 static int mv_platform_probe(struct platform_device *pdev) 4020 4020 { 4021 4021 const struct mv_sata_platform_data *mv_platform_data; 4022 + const struct mbus_dram_target_info *dram; 4022 4023 const struct ata_port_info *ppi[] = 4023 4024 { &mv_port_info[chip_soc], NULL }; 4024 4025 struct ata_host *host; ··· 4073 4072 /* 4074 4073 * (Re-)program MBUS remapping windows if we are asked to. 4075 4074 */ 4076 - if (mv_platform_data->dram != NULL) 4077 - mv_conf_mbus_windows(hpriv, mv_platform_data->dram); 4075 + dram = mv_mbus_dram_info(); 4076 + if (dram) 4077 + mv_conf_mbus_windows(hpriv, dram); 4078 4078 4079 4079 rc = mv_create_dma_pools(hpriv, &pdev->dev); 4080 4080 if (rc) ··· 4143 4141 static int mv_platform_resume(struct platform_device *pdev) 4144 4142 { 4145 4143 struct ata_host *host = platform_get_drvdata(pdev); 4144 + const struct mbus_dram_target_info *dram; 4146 4145 int ret; 4147 4146 4148 4147 if (host) { 4149 4148 struct mv_host_priv *hpriv = host->private_data; 4150 - const struct mv_sata_platform_data *mv_platform_data = \ 4151 - pdev->dev.platform_data; 4149 + 4152 4150 /* 4153 4151 * (Re-)program MBUS remapping windows if we are asked to. 4154 4152 */ 4155 - if (mv_platform_data->dram != NULL) 4156 - mv_conf_mbus_windows(hpriv, mv_platform_data->dram); 4153 + dram = mv_mbus_dram_info(); 4154 + if (dram) 4155 + mv_conf_mbus_windows(hpriv, dram); 4157 4156 4158 4157 /* initialize adapter */ 4159 4158 ret = mv_init_host(host);
+6 -5
drivers/dma/mv_xor.c
··· 1250 1250 1251 1251 static void 1252 1252 mv_xor_conf_mbus_windows(struct mv_xor_shared_private *msp, 1253 - struct mbus_dram_target_info *dram) 1253 + const struct mbus_dram_target_info *dram) 1254 1254 { 1255 1255 void __iomem *base = msp->xor_base; 1256 1256 u32 win_enable = 0; ··· 1264 1264 } 1265 1265 1266 1266 for (i = 0; i < dram->num_cs; i++) { 1267 - struct mbus_dram_window *cs = dram->cs + i; 1267 + const struct mbus_dram_window *cs = dram->cs + i; 1268 1268 1269 1269 writel((cs->base & 0xffff0000) | 1270 1270 (cs->mbus_attr << 8) | ··· 1290 1290 1291 1291 static int mv_xor_shared_probe(struct platform_device *pdev) 1292 1292 { 1293 - struct mv_xor_platform_shared_data *msd = pdev->dev.platform_data; 1293 + const struct mbus_dram_target_info *dram; 1294 1294 struct mv_xor_shared_private *msp; 1295 1295 struct resource *res; 1296 1296 ··· 1323 1323 /* 1324 1324 * (Re-)program MBUS remapping windows if we are asked to. 1325 1325 */ 1326 - if (msd != NULL && msd->dram != NULL) 1327 - mv_xor_conf_mbus_windows(msp, msd->dram); 1326 + dram = mv_mbus_dram_info(); 1327 + if (dram) 1328 + mv_xor_conf_mbus_windows(msp, dram); 1328 1329 1329 1330 return 0; 1330 1331 }
+8 -5
drivers/mmc/host/mvsdio.c
··· 679 679 .enable_sdio_irq = mvsd_enable_sdio_irq, 680 680 }; 681 681 682 - static void __init mv_conf_mbus_windows(struct mvsd_host *host, 683 - struct mbus_dram_target_info *dram) 682 + static void __init 683 + mv_conf_mbus_windows(struct mvsd_host *host, 684 + const struct mbus_dram_target_info *dram) 684 685 { 685 686 void __iomem *iobase = host->base; 686 687 int i; ··· 692 691 } 693 692 694 693 for (i = 0; i < dram->num_cs; i++) { 695 - struct mbus_dram_window *cs = dram->cs + i; 694 + const struct mbus_dram_window *cs = dram->cs + i; 696 695 writel(((cs->size - 1) & 0xffff0000) | 697 696 (cs->mbus_attr << 8) | 698 697 (dram->mbus_dram_target_id << 4) | 1, ··· 706 705 struct mmc_host *mmc = NULL; 707 706 struct mvsd_host *host = NULL; 708 707 const struct mvsdio_platform_data *mvsd_data; 708 + const struct mbus_dram_target_info *dram; 709 709 struct resource *r; 710 710 int ret, irq; 711 711 ··· 757 755 } 758 756 759 757 /* (Re-)program MBUS remapping windows if we are asked to. */ 760 - if (mvsd_data->dram != NULL) 761 - mv_conf_mbus_windows(host, mvsd_data->dram); 758 + dram = mv_mbus_dram_info(); 759 + if (dram) 760 + mv_conf_mbus_windows(host, dram); 762 761 763 762 mvsd_power_down(host); 764 763
+6 -4
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 2509 2509 /* platform glue ************************************************************/ 2510 2510 static void 2511 2511 mv643xx_eth_conf_mbus_windows(struct mv643xx_eth_shared_private *msp, 2512 - struct mbus_dram_target_info *dram) 2512 + const struct mbus_dram_target_info *dram) 2513 2513 { 2514 2514 void __iomem *base = msp->base; 2515 2515 u32 win_enable; ··· 2527 2527 win_protect = 0; 2528 2528 2529 2529 for (i = 0; i < dram->num_cs; i++) { 2530 - struct mbus_dram_window *cs = dram->cs + i; 2530 + const struct mbus_dram_window *cs = dram->cs + i; 2531 2531 2532 2532 writel((cs->base & 0xffff0000) | 2533 2533 (cs->mbus_attr << 8) | ··· 2577 2577 static int mv643xx_eth_version_printed; 2578 2578 struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data; 2579 2579 struct mv643xx_eth_shared_private *msp; 2580 + const struct mbus_dram_target_info *dram; 2580 2581 struct resource *res; 2581 2582 int ret; 2582 2583 ··· 2642 2641 /* 2643 2642 * (Re-)program MBUS remapping windows if we are asked to. 2644 2643 */ 2645 - if (pd != NULL && pd->dram != NULL) 2646 - mv643xx_eth_conf_mbus_windows(msp, pd->dram); 2644 + dram = mv_mbus_dram_info(); 2645 + if (dram) 2646 + mv643xx_eth_conf_mbus_windows(msp, dram); 2647 2647 2648 2648 /* 2649 2649 * Detect hardware parameters.
+6 -4
drivers/usb/host/ehci-orion.c
··· 172 172 173 173 static void __init 174 174 ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, 175 - struct mbus_dram_target_info *dram) 175 + const struct mbus_dram_target_info *dram) 176 176 { 177 177 int i; 178 178 ··· 182 182 } 183 183 184 184 for (i = 0; i < dram->num_cs; i++) { 185 - struct mbus_dram_window *cs = dram->cs + i; 185 + const struct mbus_dram_window *cs = dram->cs + i; 186 186 187 187 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) | 188 188 (cs->mbus_attr << 8) | ··· 194 194 static int __devinit ehci_orion_drv_probe(struct platform_device *pdev) 195 195 { 196 196 struct orion_ehci_data *pd = pdev->dev.platform_data; 197 + const struct mbus_dram_target_info *dram; 197 198 struct resource *res; 198 199 struct usb_hcd *hcd; 199 200 struct ehci_hcd *ehci; ··· 260 259 /* 261 260 * (Re-)program MBUS remapping windows if we are asked to. 262 261 */ 263 - if (pd != NULL && pd->dram != NULL) 264 - ehci_orion_conf_mbus_windows(hcd, pd->dram); 262 + dram = mv_mbus_dram_info(); 263 + if (dram) 264 + ehci_orion_conf_mbus_windows(hcd, dram); 265 265 266 266 /* 267 267 * setup Orion USB controller.
+12 -1
include/linux/mbus.h
··· 32 32 } cs[4]; 33 33 }; 34 34 35 - 35 + /* 36 + * The Marvell mbus is to be found only on SOCs from the Orion family 37 + * at the moment. Provide a dummy stub for other architectures. 38 + */ 39 + #ifdef CONFIG_PLAT_ORION 40 + extern const struct mbus_dram_target_info *mv_mbus_dram_info(void); 41 + #else 42 + static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void) 43 + { 44 + return NULL; 45 + } 46 + #endif 36 47 #endif
+9 -6
sound/soc/kirkwood/kirkwood-dma.c
··· 94 94 return IRQ_HANDLED; 95 95 } 96 96 97 - static void kirkwood_dma_conf_mbus_windows(void __iomem *base, int win, 98 - unsigned long dma, 99 - struct mbus_dram_target_info *dram) 97 + static void 98 + kirkwood_dma_conf_mbus_windows(void __iomem *base, int win, 99 + unsigned long dma, 100 + const struct mbus_dram_target_info *dram) 100 101 { 101 102 int i; 102 103 ··· 107 106 108 107 /* try to find matching cs for current dma address */ 109 108 for (i = 0; i < dram->num_cs; i++) { 110 - struct mbus_dram_window *cs = dram->cs + i; 109 + const struct mbus_dram_window *cs = dram->cs + i; 111 110 if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) { 112 111 writel(cs->base & 0xffff0000, 113 112 base + KIRKWOOD_AUDIO_WIN_BASE_REG(win)); ··· 128 127 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; 129 128 struct kirkwood_dma_data *priv; 130 129 struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); 130 + const struct mbus_dram_target_info *dram; 131 131 unsigned long addr; 132 132 133 133 priv = snd_soc_dai_get_dma_data(cpu_dai, substream); ··· 177 175 writel((unsigned long)-1, priv->io + KIRKWOOD_ERR_MASK); 178 176 } 179 177 178 + dram = mv_mbus_dram_info(); 180 179 addr = virt_to_phys(substream->dma_buffer.area); 181 180 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 182 181 prdata->play_stream = substream; 183 182 kirkwood_dma_conf_mbus_windows(priv->io, 184 - KIRKWOOD_PLAYBACK_WIN, addr, priv->dram); 183 + KIRKWOOD_PLAYBACK_WIN, addr, dram); 185 184 } else { 186 185 prdata->rec_stream = substream; 187 186 kirkwood_dma_conf_mbus_windows(priv->io, 188 - KIRKWOOD_RECORD_WIN, addr, priv->dram); 187 + KIRKWOOD_RECORD_WIN, addr, dram); 189 188 } 190 189 191 190 return 0;