Got NOR up and running on both SPI0 and SPI1
This commit is contained in:
1 parent
94c88d8121
commit
fd56eb635b
5 files changed
+15
-5
No files matched your search
@@ -244,10 +244,14 @@ static void ipod_touch_machine_init(MachineState *machine)
|
||||
set_spi_base(0);
|
||||
dev = sysbus_create_simple("ipodtouch.spi", SPI0_MEM_BASE, s5l8900_get_irq(nms, S5L8720_SPI0_IRQ));
|
||||
IPodTouchSPIState *spi0_state = IPOD_TOUCH_SPI(dev);
|
||||
nms->spi0_state = spi0_state;
|
||||
strcpy(spi0_state->nor->nor_path, nms->nor_path);
|
||||
|
||||
set_spi_base(1);
|
||||
sysbus_create_simple("ipodtouch.spi", SPI1_MEM_BASE, s5l8900_get_irq(nms, S5L8720_SPI1_IRQ));
|
||||
dev = sysbus_create_simple("ipodtouch.spi", SPI1_MEM_BASE, s5l8900_get_irq(nms, S5L8720_SPI1_IRQ));
|
||||
IPodTouchSPIState *spi1_state = IPOD_TOUCH_SPI(dev);
|
||||
nms->spi1_state = spi1_state;
|
||||
strcpy(spi1_state->nor->nor_path, nms->nor_path);
|
||||
|
||||
set_spi_base(2);
|
||||
sysbus_create_simple("ipodtouch.spi", SPI2_MEM_BASE, s5l8900_get_irq(nms, S5L8720_SPI2_IRQ));
|
||||
|
||||
@@ -12,6 +12,7 @@ static uint64_t ipod_touch_mipi_dsi_read(void *opaque, hwaddr addr, unsigned siz
|
||||
case REG_INTSRC:
|
||||
return rDSIM_INTSRC_RxDatDone;
|
||||
case REG_RXFIFO:
|
||||
return 0;
|
||||
if(!s->return_panel_id) {
|
||||
s->return_panel_id = true;
|
||||
// TODO this should be rewritten as a proper queue!
|
||||
|
||||
@@ -13,7 +13,7 @@ static uint32_t ipod_touch_nor_spi_transfer(SSIPeripheral *dev, uint32_t value)
|
||||
{
|
||||
IPodTouchNORSPIState *s = IPOD_TOUCH_NOR_SPI(dev);
|
||||
|
||||
//printf("NOR SPI received value 0x%08x\n", value);
|
||||
printf("NOR SPI received value 0x%08x\n", value);
|
||||
if(value == NOR_GET_JEDECID) {
|
||||
printf("RECEIVED JEDCID VALUE\n");
|
||||
}
|
||||
@@ -36,6 +36,7 @@ static uint32_t ipod_touch_nor_spi_transfer(SSIPeripheral *dev, uint32_t value)
|
||||
if(value == NOR_GET_STATUS_CMD) {
|
||||
s->in_buf_size = 1;
|
||||
s->out_buf_size = 1;
|
||||
s->out_buf[0] = 0;
|
||||
}
|
||||
else if(value == NOR_READ_DATA_CMD) {
|
||||
printf("Received read command!\n");
|
||||
@@ -43,7 +44,6 @@ static uint32_t ipod_touch_nor_spi_transfer(SSIPeripheral *dev, uint32_t value)
|
||||
s->out_buf_size = 4096;
|
||||
}
|
||||
else if(value == NOR_GET_JEDECID) {
|
||||
printf("WILL RETURN JEDCID\n");
|
||||
s->in_buf_size = 1;
|
||||
s->out_buf_size = 3;
|
||||
s->out_buf[0] = 0x1F; // vendor: atmel, device: 0x02 -> AT25DF081A
|
||||
|
||||
@@ -284,14 +284,17 @@ static void ipod_touch_spi_realize(DeviceState *dev, struct Error **errp)
|
||||
fifo8_create(&s->rx_fifo, R_FIFO_DEPTH);
|
||||
|
||||
// create the peripheral
|
||||
IPodTouchNORSPIState *nor;
|
||||
switch(s->base) {
|
||||
case 0:
|
||||
ssi_create_peripheral(s->spi, TYPE_IPOD_TOUCH_NOR_SPI);
|
||||
IPodTouchNORSPIState *nor = IPOD_TOUCH_NOR_SPI(dev);
|
||||
nor = IPOD_TOUCH_NOR_SPI(dev);
|
||||
s->nor = nor;
|
||||
break;
|
||||
case 1:
|
||||
//ssi_create_peripheral(s->spi, TYPE_IPOD_TOUCH_LCD_PANEL);
|
||||
ssi_create_peripheral(s->spi, TYPE_IPOD_TOUCH_NOR_SPI);
|
||||
nor = IPOD_TOUCH_NOR_SPI(dev);
|
||||
s->nor = nor;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user