balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 1 | /* vim:set shiftwidth=4 ts=4 et: */ |
| 2 | /* |
| 3 | * PXA255 Sharp Zaurus SL-6000 PDA platform |
| 4 | * |
| 5 | * Copyright (c) 2008 Dmitry Baryshkov |
| 6 | * |
| 7 | * Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org> |
| 8 | * This code is licensed under the GNU GPL v2. |
Paolo Bonzini | 6b620ca | 2012-01-13 17:44:23 +0100 | [diff] [blame] | 9 | * |
| 10 | * Contributions after 2012-01-13 are licensed under the terms of the |
| 11 | * GNU GPL, version 2 or (at your option) any later version. |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include "hw.h" |
| 15 | #include "pxa.h" |
| 16 | #include "arm-misc.h" |
balrog | 88d2c95 | 2008-06-09 00:03:13 +0000 | [diff] [blame] | 17 | #include "devices.h" |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 18 | #include "sharpsl.h" |
| 19 | #include "pcmcia.h" |
| 20 | #include "block.h" |
| 21 | #include "boards.h" |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 22 | #include "i2c.h" |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 23 | #include "ssi.h" |
Blue Swirl | 2446333 | 2010-08-24 15:22:24 +0000 | [diff] [blame] | 24 | #include "blockdev.h" |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 25 | #include "sysbus.h" |
Richard Henderson | a6dc4c2 | 2011-08-11 16:07:19 -0700 | [diff] [blame] | 26 | #include "exec-memory.h" |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 27 | |
| 28 | #define TOSA_RAM 0x04000000 |
| 29 | #define TOSA_ROM 0x00800000 |
| 30 | |
Dmitry Eremin-Solenikov | 2e4b4e7 | 2011-02-11 23:57:37 +0300 | [diff] [blame] | 31 | #define TOSA_GPIO_USB_IN (5) |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 32 | #define TOSA_GPIO_nSD_DETECT (9) |
| 33 | #define TOSA_GPIO_ON_RESET (19) |
| 34 | #define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ |
| 35 | #define TOSA_GPIO_CF_CD (13) |
balrog | 5d98751 | 2008-11-04 08:45:49 +0000 | [diff] [blame] | 36 | #define TOSA_GPIO_TC6393XB_INT (15) |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 37 | #define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ |
| 38 | |
balrog | 6bc1d85 | 2008-11-04 08:43:54 +0000 | [diff] [blame] | 39 | #define TOSA_SCOOP_GPIO_BASE 1 |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 40 | #define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) |
| 41 | #define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) |
| 42 | #define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) |
| 43 | |
balrog | 6bc1d85 | 2008-11-04 08:43:54 +0000 | [diff] [blame] | 44 | #define TOSA_SCOOP_JC_GPIO_BASE 1 |
| 45 | #define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) |
| 46 | #define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) |
| 47 | #define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) |
balrog | 64b40bc | 2008-11-04 09:04:41 +0000 | [diff] [blame] | 48 | #define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5) |
balrog | 6bc1d85 | 2008-11-04 08:43:54 +0000 | [diff] [blame] | 49 | #define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) |
| 50 | |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 51 | #define DAC_BASE 0x4e |
| 52 | #define DAC_CH1 0 |
| 53 | #define DAC_CH2 1 |
| 54 | |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 55 | static void tosa_microdrive_attach(PXA2xxState *cpu) |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 56 | { |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 57 | PCMCIACardState *md; |
Gerd Hoffmann | 751c6a1 | 2009-07-22 16:42:57 +0200 | [diff] [blame] | 58 | DriveInfo *dinfo; |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 59 | |
Gerd Hoffmann | 751c6a1 | 2009-07-22 16:42:57 +0200 | [diff] [blame] | 60 | dinfo = drive_get(IF_IDE, 0, 0); |
Markus Armbruster | 124386c | 2011-08-03 15:08:13 +0200 | [diff] [blame] | 61 | if (!dinfo || dinfo->media_cd) |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 62 | return; |
Markus Armbruster | 124386c | 2011-08-03 15:08:13 +0200 | [diff] [blame] | 63 | md = dscm1xxxx_init(dinfo); |
| 64 | pxa2xx_pcmcia_attach(cpu->pcmcia[0], md); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 65 | } |
| 66 | |
balrog | 6bc1d85 | 2008-11-04 08:43:54 +0000 | [diff] [blame] | 67 | static void tosa_out_switch(void *opaque, int line, int level) |
| 68 | { |
| 69 | switch (line) { |
| 70 | case 0: |
| 71 | fprintf(stderr, "blue LED %s.\n", level ? "on" : "off"); |
| 72 | break; |
| 73 | case 1: |
| 74 | fprintf(stderr, "green LED %s.\n", level ? "on" : "off"); |
| 75 | break; |
| 76 | case 2: |
| 77 | fprintf(stderr, "amber LED %s.\n", level ? "on" : "off"); |
| 78 | break; |
| 79 | case 3: |
| 80 | fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off"); |
| 81 | break; |
| 82 | default: |
| 83 | fprintf(stderr, "Uhandled out event: %d = %d\n", line, level); |
| 84 | break; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 89 | static void tosa_gpio_setup(PXA2xxState *cpu, |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 90 | DeviceState *scp0, |
| 91 | DeviceState *scp1, |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 92 | TC6393xbState *tmio) |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 93 | { |
balrog | 6bc1d85 | 2008-11-04 08:43:54 +0000 | [diff] [blame] | 94 | qemu_irq *outsignals = qemu_allocate_irqs(tosa_out_switch, cpu, 4); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 95 | /* MMC/SD host */ |
| 96 | pxa2xx_mmci_handlers(cpu->mmc, |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 97 | qdev_get_gpio_in(scp0, TOSA_GPIO_SD_WP), |
Dmitry Eremin-Solenikov | 0bb5333 | 2011-01-21 19:57:50 +0300 | [diff] [blame] | 98 | qemu_irq_invert(qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_nSD_DETECT))); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 99 | |
| 100 | /* Handle reset */ |
Dmitry Eremin-Solenikov | 0bb5333 | 2011-01-21 19:57:50 +0300 | [diff] [blame] | 101 | qdev_connect_gpio_out(cpu->gpio, TOSA_GPIO_ON_RESET, cpu->reset); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 102 | |
| 103 | /* PCMCIA signals: card's IRQ and Card-Detect */ |
| 104 | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0], |
Dmitry Eremin-Solenikov | 0bb5333 | 2011-01-21 19:57:50 +0300 | [diff] [blame] | 105 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_CF_IRQ), |
| 106 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_CF_CD)); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 107 | |
| 108 | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1], |
Dmitry Eremin-Solenikov | 0bb5333 | 2011-01-21 19:57:50 +0300 | [diff] [blame] | 109 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_JC_CF_IRQ), |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 110 | NULL); |
| 111 | |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 112 | qdev_connect_gpio_out(scp1, TOSA_GPIO_BT_LED, outsignals[0]); |
| 113 | qdev_connect_gpio_out(scp1, TOSA_GPIO_NOTE_LED, outsignals[1]); |
| 114 | qdev_connect_gpio_out(scp1, TOSA_GPIO_CHRG_ERR_LED, outsignals[2]); |
| 115 | qdev_connect_gpio_out(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]); |
balrog | 64b40bc | 2008-11-04 09:04:41 +0000 | [diff] [blame] | 116 | |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 117 | qdev_connect_gpio_out(scp1, TOSA_GPIO_TC6393XB_L3V_ON, tc6393xb_l3v_get(tmio)); |
Dmitry Eremin-Solenikov | 2e4b4e7 | 2011-02-11 23:57:37 +0300 | [diff] [blame] | 118 | |
| 119 | /* UDC Vbus */ |
| 120 | qemu_irq_raise(qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_USB_IN)); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 121 | } |
| 122 | |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 123 | static uint32_t tosa_ssp_tansfer(SSISlave *dev, uint32_t value) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 124 | { |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 125 | fprintf(stderr, "TG: %d %02x\n", value >> 5, value & 0x1f); |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 126 | return 0; |
| 127 | } |
| 128 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 129 | static int tosa_ssp_init(SSISlave *dev) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 130 | { |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 131 | /* Nothing to do. */ |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 132 | return 0; |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Paul Brook | d315152 | 2009-05-12 15:38:55 +0100 | [diff] [blame] | 135 | typedef struct { |
Anthony Liguori | 9e07bdf | 2011-12-04 20:28:27 -0600 | [diff] [blame] | 136 | I2CSlave i2c; |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 137 | int len; |
| 138 | char buf[3]; |
Paul Brook | d315152 | 2009-05-12 15:38:55 +0100 | [diff] [blame] | 139 | } TosaDACState; |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 140 | |
Anthony Liguori | 9e07bdf | 2011-12-04 20:28:27 -0600 | [diff] [blame] | 141 | static int tosa_dac_send(I2CSlave *i2c, uint8_t data) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 142 | { |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 143 | TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c); |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 144 | s->buf[s->len] = data; |
| 145 | if (s->len ++ > 2) { |
| 146 | #ifdef VERBOSE |
| 147 | fprintf(stderr, "%s: message too long (%i bytes)\n", __FUNCTION__, s->len); |
| 148 | #endif |
| 149 | return 1; |
| 150 | } |
| 151 | |
| 152 | if (s->len == 2) { |
| 153 | fprintf(stderr, "dac: channel %d value 0x%02x\n", |
| 154 | s->buf[0], s->buf[1]); |
| 155 | } |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | |
Anthony Liguori | 9e07bdf | 2011-12-04 20:28:27 -0600 | [diff] [blame] | 160 | static void tosa_dac_event(I2CSlave *i2c, enum i2c_event event) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 161 | { |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 162 | TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c); |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 163 | s->len = 0; |
| 164 | switch (event) { |
| 165 | case I2C_START_SEND: |
| 166 | break; |
| 167 | case I2C_START_RECV: |
| 168 | printf("%s: recv not supported!!!\n", __FUNCTION__); |
| 169 | break; |
| 170 | case I2C_FINISH: |
| 171 | #ifdef VERBOSE |
| 172 | if (s->len < 2) |
| 173 | printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); |
| 174 | if (s->len > 2) |
| 175 | printf("%s: message too long\n", __FUNCTION__); |
| 176 | #endif |
| 177 | break; |
| 178 | default: |
| 179 | break; |
| 180 | } |
| 181 | } |
| 182 | |
Anthony Liguori | 9e07bdf | 2011-12-04 20:28:27 -0600 | [diff] [blame] | 183 | static int tosa_dac_recv(I2CSlave *s) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 184 | { |
| 185 | printf("%s: recv not supported!!!\n", __FUNCTION__); |
| 186 | return -1; |
| 187 | } |
| 188 | |
Anthony Liguori | 9e07bdf | 2011-12-04 20:28:27 -0600 | [diff] [blame] | 189 | static int tosa_dac_init(I2CSlave *i2c) |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 190 | { |
| 191 | /* Nothing to do. */ |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 192 | return 0; |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 193 | } |
| 194 | |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 195 | static void tosa_tg_init(PXA2xxState *cpu) |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 196 | { |
Paul Brook | d315152 | 2009-05-12 15:38:55 +0100 | [diff] [blame] | 197 | i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 198 | i2c_create_slave(bus, "tosa_dac", DAC_BASE); |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 199 | ssi_create_slave(cpu->ssp[1], "tosa-ssp"); |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 203 | static struct arm_boot_info tosa_binfo = { |
| 204 | .loader_start = PXA2XX_SDRAM_BASE, |
| 205 | .ram_size = 0x04000000, |
| 206 | }; |
| 207 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 208 | static void tosa_init(ram_addr_t ram_size, |
aliguori | 3023f33 | 2009-01-16 19:04:14 +0000 | [diff] [blame] | 209 | const char *boot_device, |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 210 | const char *kernel_filename, const char *kernel_cmdline, |
| 211 | const char *initrd_filename, const char *cpu_model) |
| 212 | { |
Richard Henderson | a6dc4c2 | 2011-08-11 16:07:19 -0700 | [diff] [blame] | 213 | MemoryRegion *address_space_mem = get_system_memory(); |
Avi Kivity | 04d6668 | 2011-10-05 18:29:06 +0200 | [diff] [blame] | 214 | MemoryRegion *rom = g_new(MemoryRegion, 1); |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 215 | PXA2xxState *cpu; |
| 216 | TC6393xbState *tmio; |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 217 | DeviceState *scp0, *scp1; |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 218 | |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 219 | if (!cpu_model) |
| 220 | cpu_model = "pxa255"; |
| 221 | |
Richard Henderson | a6dc4c2 | 2011-08-11 16:07:19 -0700 | [diff] [blame] | 222 | cpu = pxa255_init(address_space_mem, tosa_binfo.ram_size); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 223 | |
Avi Kivity | c5705a7 | 2011-12-20 15:59:12 +0200 | [diff] [blame] | 224 | memory_region_init_ram(rom, "tosa.rom", TOSA_ROM); |
| 225 | vmstate_register_ram_global(rom); |
Avi Kivity | 04d6668 | 2011-10-05 18:29:06 +0200 | [diff] [blame] | 226 | memory_region_set_readonly(rom, true); |
| 227 | memory_region_add_subregion(address_space_mem, 0, rom); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 228 | |
Avi Kivity | fe06bd9 | 2011-10-03 14:42:42 +0200 | [diff] [blame] | 229 | tmio = tc6393xb_init(address_space_mem, 0x10000000, |
Dmitry Eremin-Solenikov | 0bb5333 | 2011-01-21 19:57:50 +0300 | [diff] [blame] | 230 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_TC6393XB_INT)); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 231 | |
Dmitry Eremin-Solenikov | 383d01c | 2011-01-20 18:52:27 +0300 | [diff] [blame] | 232 | scp0 = sysbus_create_simple("scoop", 0x08800000, NULL); |
| 233 | scp1 = sysbus_create_simple("scoop", 0x14800040, NULL); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 234 | |
balrog | 64b40bc | 2008-11-04 09:04:41 +0000 | [diff] [blame] | 235 | tosa_gpio_setup(cpu, scp0, scp1, tmio); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 236 | |
| 237 | tosa_microdrive_attach(cpu); |
| 238 | |
balrog | 4ea29f7 | 2008-11-04 08:54:23 +0000 | [diff] [blame] | 239 | tosa_tg_init(cpu); |
| 240 | |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 241 | tosa_binfo.kernel_filename = kernel_filename; |
| 242 | tosa_binfo.kernel_cmdline = kernel_cmdline; |
| 243 | tosa_binfo.initrd_filename = initrd_filename; |
| 244 | tosa_binfo.board_id = 0x208; |
| 245 | arm_load_kernel(cpu->env, &tosa_binfo); |
pbrook | f78630a | 2009-04-09 17:48:30 +0000 | [diff] [blame] | 246 | sl_bootparam_write(SL_PXA_PARAM_BASE); |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 247 | } |
| 248 | |
Anthony Liguori | f80f9ec | 2009-05-20 18:38:09 -0500 | [diff] [blame] | 249 | static QEMUMachine tosapda_machine = { |
aliguori | 4b32e16 | 2008-10-07 20:34:35 +0000 | [diff] [blame] | 250 | .name = "tosa", |
| 251 | .desc = "Tosa PDA (PXA255)", |
| 252 | .init = tosa_init, |
balrog | 89cdb6a | 2008-06-02 01:33:11 +0000 | [diff] [blame] | 253 | }; |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 254 | |
Anthony Liguori | f80f9ec | 2009-05-20 18:38:09 -0500 | [diff] [blame] | 255 | static void tosapda_machine_init(void) |
| 256 | { |
| 257 | qemu_register_machine(&tosapda_machine); |
| 258 | } |
| 259 | |
| 260 | machine_init(tosapda_machine_init); |
| 261 | |
Anthony Liguori | b5ea932 | 2011-12-04 20:39:20 -0600 | [diff] [blame] | 262 | static void tosa_dac_class_init(ObjectClass *klass, void *data) |
| 263 | { |
| 264 | I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); |
| 265 | |
| 266 | k->init = tosa_dac_init; |
| 267 | k->event = tosa_dac_event; |
| 268 | k->recv = tosa_dac_recv; |
| 269 | k->send = tosa_dac_send; |
| 270 | } |
| 271 | |
Anthony Liguori | 39bffca | 2011-12-07 21:34:16 -0600 | [diff] [blame] | 272 | static TypeInfo tosa_dac_info = { |
| 273 | .name = "tosa_dac", |
| 274 | .parent = TYPE_I2C_SLAVE, |
| 275 | .instance_size = sizeof(TosaDACState), |
| 276 | .class_init = tosa_dac_class_init, |
| 277 | }; |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 278 | |
Anthony Liguori | cd6c4cf | 2011-12-16 13:36:39 -0600 | [diff] [blame] | 279 | static void tosa_ssp_class_init(ObjectClass *klass, void *data) |
| 280 | { |
| 281 | SSISlaveClass *k = SSI_SLAVE_CLASS(klass); |
| 282 | |
| 283 | k->init = tosa_ssp_init; |
| 284 | k->transfer = tosa_ssp_tansfer; |
| 285 | } |
| 286 | |
Anthony Liguori | 39bffca | 2011-12-07 21:34:16 -0600 | [diff] [blame] | 287 | static TypeInfo tosa_ssp_info = { |
| 288 | .name = "tosa-ssp", |
| 289 | .parent = TYPE_SSI_SLAVE, |
| 290 | .instance_size = sizeof(SSISlave), |
| 291 | .class_init = tosa_ssp_class_init, |
Paul Brook | a984a69 | 2009-05-14 22:35:09 +0100 | [diff] [blame] | 292 | }; |
| 293 | |
Andreas Färber | 83f7d43 | 2012-02-09 15:20:55 +0100 | [diff] [blame] | 294 | static void tosa_register_types(void) |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 295 | { |
Anthony Liguori | 39bffca | 2011-12-07 21:34:16 -0600 | [diff] [blame] | 296 | type_register_static(&tosa_dac_info); |
| 297 | type_register_static(&tosa_ssp_info); |
Paul Brook | fd1eb2e | 2009-05-14 22:35:08 +0100 | [diff] [blame] | 298 | } |
| 299 | |
Andreas Färber | 83f7d43 | 2012-02-09 15:20:55 +0100 | [diff] [blame] | 300 | type_init(tosa_register_types) |