| 1 | --- a/arch/mips/lantiq/devices.c |
| 2 | +++ b/arch/mips/lantiq/devices.c |
| 3 | @@ -18,6 +18,7 @@ |
| 4 | #include <linux/time.h> |
| 5 | #include <linux/io.h> |
| 6 | #include <linux/gpio.h> |
| 7 | +#include <linux/dma-mapping.h> |
| 8 | |
| 9 | #include <asm/bootinfo.h> |
| 10 | #include <asm/irq.h> |
| 11 | @@ -100,3 +101,20 @@ void __init ltq_register_pci(struct ltq_ |
| 12 | pr_err("kernel is compiled without PCI support\n"); |
| 13 | } |
| 14 | #endif |
| 15 | + |
| 16 | +static unsigned int *cp1_base = 0; |
| 17 | +unsigned int* |
| 18 | +ltq_get_cp1_base(void) |
| 19 | +{ |
| 20 | + return cp1_base; |
| 21 | +} |
| 22 | +EXPORT_SYMBOL(ltq_get_cp1_base); |
| 23 | + |
| 24 | +void __init |
| 25 | +ltq_register_tapi(void) |
| 26 | +{ |
| 27 | +#define CP1_SIZE (1 << 20) |
| 28 | + dma_addr_t dma; |
| 29 | + cp1_base = |
| 30 | + (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC)); |
| 31 | +} |
| 32 | --- a/arch/mips/lantiq/devices.h |
| 33 | +++ b/arch/mips/lantiq/devices.h |
| 34 | @@ -23,5 +23,6 @@ extern void ltq_register_nor(struct phys |
| 35 | extern void ltq_register_wdt(void); |
| 36 | extern void ltq_register_asc(int port); |
| 37 | extern void ltq_register_pci(struct ltq_pci_data *data); |
| 38 | +extern void ltq_register_tapi(void); |
| 39 | |
| 40 | #endif |
| 41 | --- a/arch/mips/lantiq/xway/Makefile |
| 42 | +++ b/arch/mips/lantiq/xway/Makefile |
| 43 | @@ -1,5 +1,7 @@ |
| 44 | obj-y := sysctrl.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o nand.o timer.o |
| 45 | |
| 46 | +obj-y += dev-dwc_otg.o dev-wifi-rt2x00.o dev-wifi-ath5k.o |
| 47 | + |
| 48 | obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o |
| 49 | obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o |
| 50 | obj-$(CONFIG_SOC_VR9) += clk-vr9.o prom-vr9.o |
| 51 | --- a/arch/mips/lantiq/xway/devices.c |
| 52 | +++ b/arch/mips/lantiq/xway/devices.c |
| 53 | @@ -19,6 +19,7 @@ |
| 54 | #include <linux/time.h> |
| 55 | #include <linux/io.h> |
| 56 | #include <linux/gpio.h> |
| 57 | +#include <linux/spi/spi.h> |
| 58 | |
| 59 | #include <asm/bootinfo.h> |
| 60 | #include <asm/irq.h> |
| 61 | @@ -99,3 +100,98 @@ ltq_register_etop(struct ltq_eth_data *e |
| 62 | platform_device_register(<q_etop); |
| 63 | } |
| 64 | } |
| 65 | + |
| 66 | +/* madwifi */ |
| 67 | +int lantiq_emulate_madwifi_eep = 0; |
| 68 | +EXPORT_SYMBOL(lantiq_emulate_madwifi_eep); |
| 69 | + |
| 70 | +int lantiq_madwifi_eep_addr = 0; |
| 71 | +EXPORT_SYMBOL(lantiq_madwifi_eep_addr); |
| 72 | + |
| 73 | +void __init |
| 74 | +ltq_register_madwifi_eep(unsigned long long addr) |
| 75 | +{ |
| 76 | + lantiq_madwifi_eep_addr = addr; |
| 77 | + lantiq_emulate_madwifi_eep = 1; |
| 78 | +} |
| 79 | + |
| 80 | +/* ebu */ |
| 81 | +static struct resource ltq_ebu_resource = |
| 82 | +{ |
| 83 | + .name = "gpio_ebu", |
| 84 | + .start = LTQ_EBU_GPIO_START, |
| 85 | + .end = LTQ_EBU_GPIO_START + LTQ_EBU_GPIO_SIZE - 1, |
| 86 | + .flags = IORESOURCE_MEM, |
| 87 | +}; |
| 88 | + |
| 89 | +static struct platform_device ltq_ebu = |
| 90 | +{ |
| 91 | + .name = "ltq_ebu", |
| 92 | + .resource = <q_ebu_resource, |
| 93 | + .num_resources = 1, |
| 94 | +}; |
| 95 | + |
| 96 | +void __init |
| 97 | +ltq_register_gpio_ebu(unsigned int value) |
| 98 | +{ |
| 99 | + ltq_ebu.dev.platform_data = (void*) value; |
| 100 | + platform_device_register(<q_ebu); |
| 101 | +} |
| 102 | + |
| 103 | +/* gpio buttons */ |
| 104 | +static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data; |
| 105 | + |
| 106 | +static struct platform_device ltq_gpio_buttons_platform_device = |
| 107 | +{ |
| 108 | + .name = "gpio-buttons", |
| 109 | + .id = 0, |
| 110 | + .dev = { |
| 111 | + .platform_data = (void *) <q_gpio_buttons_platform_data, |
| 112 | + }, |
| 113 | +}; |
| 114 | + |
| 115 | +void __init |
| 116 | +ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt) |
| 117 | +{ |
| 118 | + ltq_gpio_buttons_platform_data.buttons = buttons; |
| 119 | + ltq_gpio_buttons_platform_data.nbuttons = cnt; |
| 120 | + platform_device_register(<q_gpio_buttons_platform_device); |
| 121 | +} |
| 122 | + |
| 123 | +static struct resource ltq_spi_resources[] = { |
| 124 | + { |
| 125 | + .start = LTQ_SSC_BASE_ADDR, |
| 126 | + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, |
| 127 | + .flags = IORESOURCE_MEM, |
| 128 | + }, |
| 129 | + IRQ_RES(spi_tx, LTQ_SSC_TIR), |
| 130 | + IRQ_RES(spi_rx, LTQ_SSC_RIR), |
| 131 | + IRQ_RES(spi_err, LTQ_SSC_EIR), |
| 132 | +}; |
| 133 | + |
| 134 | +static struct resource ltq_spi_resources_ar9[] = { |
| 135 | + { |
| 136 | + .start = LTQ_SSC_BASE_ADDR, |
| 137 | + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, |
| 138 | + .flags = IORESOURCE_MEM, |
| 139 | + }, |
| 140 | + IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9), |
| 141 | + IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9), |
| 142 | + IRQ_RES(spi_err, LTQ_SSC_EIR), |
| 143 | +}; |
| 144 | + |
| 145 | +static struct platform_device ltq_spi = { |
| 146 | + .name = "ltq-spi", |
| 147 | + .resource = ltq_spi_resources, |
| 148 | + .num_resources = ARRAY_SIZE(ltq_spi_resources), |
| 149 | +}; |
| 150 | + |
| 151 | +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata, |
| 152 | + struct spi_board_info const *info, unsigned n) |
| 153 | +{ |
| 154 | + if(ltq_is_ar9()) |
| 155 | + ltq_spi.resource = ltq_spi_resources_ar9; |
| 156 | + spi_register_board_info(info, n); |
| 157 | + ltq_spi.dev.platform_data = pdata; |
| 158 | + platform_device_register(<q_spi); |
| 159 | +} |
| 160 | --- a/arch/mips/lantiq/xway/devices.h |
| 161 | +++ b/arch/mips/lantiq/xway/devices.h |
| 162 | @@ -11,10 +11,17 @@ |
| 163 | |
| 164 | #include "../devices.h" |
| 165 | #include <linux/phy.h> |
| 166 | +#include <linux/spi/spi.h> |
| 167 | +#include <linux/gpio_buttons.h> |
| 168 | |
| 169 | extern void ltq_register_gpio(void); |
| 170 | extern void ltq_register_gpio_stp(void); |
| 171 | extern void ltq_register_ase_asc(void); |
| 172 | extern void ltq_register_etop(struct ltq_eth_data *eth); |
| 173 | +extern void ltq_register_gpio_ebu(unsigned int value); |
| 174 | +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata, |
| 175 | + struct spi_board_info const *info, unsigned n); |
| 176 | +extern void ltq_register_madwifi_eep(unsigned long long addr); |
| 177 | +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt); |
| 178 | |
| 179 | #endif |
| 180 | --- a/arch/mips/lantiq/Makefile |
| 181 | +++ b/arch/mips/lantiq/Makefile |
| 182 | @@ -4,7 +4,7 @@ |
| 183 | # under the terms of the GNU General Public License version 2 as published |
| 184 | # by the Free Software Foundation. |
| 185 | |
| 186 | -obj-y := irq.o setup.o clk.o prom.o devices.o |
| 187 | +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o |
| 188 | |
| 189 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
| 190 | |
| 191 | |