Skip to contentSkip to conversation

PPC4xx IIC and MAL

PATCH In review Salvatore Lionetti 2 participants 5 messages Dec 9, 2008 – Dec 10, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 PPC4xx IIC and MAL

Hi

This set of patch try to full support hw present in 'walnut' board.
http://elinux.org/DHT-Walnut

The fw used to successfully verify board is u-boot-1.3.4.

The only component not tested is PCI: perhaps should be a good start point for Hollis 's recent work, which i thanks for previous code review.

1) IIC: new eeprom device, full emulation of 4xx master core
MAL: Moved interface so can be shared with other modules
4xx boards: move MAL & IIC common part between ppc4xx cpu
add a list of created devices, so machine 2 phase creation is allowed,

Warning: to compile:
- comment line 'ppc4xx_emac_init(...)' in module hw/ppc405_boards.c
- rename ppc405ep_init(args) in ppc405xp_init("405ep", args, NULL)

Files changed:
- Makefile.target
- Makefile
- hw/ppc405_uc.c
- hw/ppc4xx_devs.c
- hw/ppc405.h
- hw/i2c.h
- hw/iic_eeprom.c (Added)
- hw/ppc4xx.h

Makefile.target +2 -2
Index: Makefile.target
===================================================================
@@ -668,7 +668,7 @@
 ifeq ($(TARGET_BASE_ARCH), ppc)
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 # shared objects
-OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
+OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o i2c.o openpic.o
 # PREP target
 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
 OBJS+= prep_pci.o ppc_prep.o
@@ -679,7 +679,7 @@
 # NewWorld PowerMac
 OBJS+= unin_pci.o ppc_chrp.o
 # PowerPC 4xx boards
-OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
+OBJS+= pflash_cfi02.o ppc4xx_emac.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
 endif
 ifeq ($(TARGET_BASE_ARCH), mips)
 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
Makefile +1 -1
Index: Makefile
===================================================================
@@ -69,7 +69,7 @@
 OBJS+=readline.o console.o
 
 OBJS+=irq.o
-OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
+OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o iic_eeprom.o
 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
 OBJS+=tmp105.o lm832x.o
 OBJS+=scsi-disk.o cdrom.o
ppc405_uc.c +40 -526

670 lines not on this page · raw message

ppc4xx_devs.c +761 -4

798 lines not on this page · raw message

ppc405.h +7 -6
Index: hw/ppc405.h
===================================================================
@@ -84,9 +84,6 @@
                          CharDriverState *chr);
 /* On Chip Memory */
 void ppc405_ocm_init (CPUState *env, unsigned long offset);
-/* I2C controller */
-void ppc405_i2c_init (CPUState *env, ppc4xx_mmio_t *mmio,
-                      target_phys_addr_t offset, qemu_irq irq);
 /* General purpose timers */
 void ppc4xx_gpt_init (CPUState *env, ppc4xx_mmio_t *mmio,
                       target_phys_addr_t offset, qemu_irq irq[5]);
@@ -96,11 +93,15 @@
 CPUState *ppc405cr_init (target_phys_addr_t ram_bases[4],
                          target_phys_addr_t ram_sizes[4],
                          uint32_t sysclk, qemu_irq **picp,
-                         ram_addr_t *offsetp, int do_init);
-CPUState *ppc405ep_init (target_phys_addr_t ram_bases[2],
+                         ram_addr_t *offsetp, int do_init,
+                         ppc4xx_devsL *devsL);
+CPUState *ppc405xp_init (const char* cpu_model,
+			 target_phys_addr_t ram_bases[2],
                          target_phys_addr_t ram_sizes[2],
                          uint32_t sysclk, qemu_irq **picp,
-                         ram_addr_t *offsetp, int do_init);
+                         ram_addr_t *offsetp, int do_init,
+                         ppc4xx_devsL *devsL);
+                          
 /* IBM STBxxx microcontrollers */
 CPUState *ppc_stb025_init (target_phys_addr_t ram_bases[2],
                            target_phys_addr_t ram_sizes[2],
i2c.h +3 -0
Index: hw/i2c.h
===================================================================
@@ -87,4 +87,7 @@
 struct i2c_slave *lm8323_init(i2c_bus *bus, qemu_irq nirq);
 void lm832x_key_event(struct i2c_slave *i2c, int key, int state);
 
+/* eeprom, like 24LC256 */
+enum  iic_eeprom_cp {IIC_EEPROM_DEEP_COPY, IIC_EEPROM_SHALLOW_COPY};
+struct i2c_slave *iic_eeprom_init(i2c_bus *bus, int bus_width, size_t sizeB, char *data, enum iic_eeprom_cp);
 #endif
ppc4xx.h +75 -0

85 lines not on this page · raw message

iic_eeprom.c +209 -0

209 lines not on this page · raw message

#1 lore raw
Quoted 21 lines · Salvatore Lionetti

Hi

This set of patch try to full support hw present in 'walnut' board.
http://elinux.org/DHT-Walnut

The fw used to successfully verify board is u-boot-1.3.4.

The only component not tested is PCI: perhaps should be a good start point for Hollis 's recent work, which i thanks for previous code review.

1) IIC: new eeprom device, full emulation of 4xx master core
MAL: Moved interface so can be shared with other modules 4xx boards: move MAL & IIC common part between ppc4xx cpu
add a list of created devices, so machine 2 phase
creation is allowed,

Warning: to compile:
- comment line 'ppc4xx_emac_init(...)' in module hw/ppc405_boards.c
- rename ppc405ep_init(args) in ppc405xp_init("405ep", args, NULL)

Quoted 9 lines

Files changed:
- Makefile.target
- Makefile
- hw/ppc405_uc.c
- hw/ppc4xx_devs.c
- hw/ppc405.h
- hw/i2c.h
- hw/iic_eeprom.c (Added)
- hw/ppc4xx.h

Please split this into smaller patches which can be more easily reviewed. For example, you should send one patch that *only* moves the i2c code (and makes no changes). Then submit a patch that modifies the code in its new location. You should submit separate patches for MAL and I2C. You should not change the DEBUG #defines, nor add debug calls to printf.

In other words, please remove all extraneous changes from your patch, and break it up into small self-contained pieces that can be committed one by one.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw

Ok

1) The line code modified is 80% IIC, only few row about MAL
2) MAL until today (if ever this patch enter in qemu) is only used to rw registers, so no malfunction is present.
3) As you can see many ppc* file are to modify since I2C previous support it totally not integrated: have sense modify ppc* and never use an IIC device?
4) Is error prone and very tedious to extract some code, expecially if there is no modularity advantage: one piece require the other,
5) I already have successfully tested the expected patch.
6) I can't do that directly so every time have 2 see if main line is updated or not, merge svn file with current my patch status
7) Who apply the patch only apply one click?

In this moment i have no time to make all this retail and test. Thanks for punctual feeling.

Salvatore

--- Mar 9/12/08, Hollis Blanchard <[email protected]> ha scritto:

Quoted 68 lines

Da: Hollis Blanchard <[email protected]>
Oggetto: Re: [Qemu-devel] [PATCH 1/3] PPC4xx IIC and MAL
A: [email protected]
Cc: "qemu-devel" <[email protected]>
Data: Martedì 9 dicembre 2008, 17:57

Quoted 3 lines · Salvatore Lionetti

Hi

This set of patch try to full support hw present in

'walnut' board.

Quoted 3 lines

http://elinux.org/DHT-Walnut

The fw used to successfully verify board is

u-boot-1.3.4.

Quoted 2 lines

The only component not tested is PCI: perhaps should

be a good start

Quoted 1 line

point for Hollis 's recent work, which i thanks

for previous code

Quoted 3 lines

review.

1) IIC: new eeprom device, full emulation of 4xx

master core

Quoted 1 line

MAL: Moved interface so can be shared with other

modules

Quoted 1 line

4xx boards: move MAL & IIC common part between

ppc4xx cpu

Quoted 1 line

add a list of created devices, so

machine 2 phase

Quoted 4 lines

creation is allowed,

Warning: to compile:
- comment line 'ppc4xx_emac_init(...)' in

module hw/ppc405_boards.c

Quoted 1 line

- rename ppc405ep_init(args) in

ppc405xp_init("405ep", args, NULL)

Quoted 10 lines

Files changed:
- Makefile.target
- Makefile
- hw/ppc405_uc.c
- hw/ppc4xx_devs.c
- hw/ppc405.h
- hw/i2c.h
- hw/iic_eeprom.c (Added)
- hw/ppc4xx.h

Please split this into smaller patches which can be more easily
reviewed. For example, you should send one patch that *only* moves the
i2c code (and makes no changes). Then submit a patch that modifies the
code in its new location. You should submit separate patches for MAL and
I2C. You should not change the DEBUG #defines, nor add debug calls to
printf.

In other words, please remove all extraneous changes from your patch,
and break it up into small self-contained pieces that can be committed
one by one.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#3 lore raw
Quoted 15 lines · Salvatore Lionetti

Ok

1) The line code modified is 80% IIC, only few row about MAL
2) MAL until today (if ever this patch enter in qemu) is only used to rw registers, so no malfunction is present.
3) As you can see many ppc* file are to modify since I2C previous support it totally not integrated: have sense modify ppc* and never use an IIC device?
4) Is error prone and very tedious to extract some code, expecially if there is no modularity advantage: one piece require the other,
5) I already have successfully tested the expected patch.
6) I can't do that directly so every time have 2 see if main line is updated or not, merge svn file with current my patch status
7) Who apply the patch only apply one click?

Quoted 1 line

In this moment i have no time to make all this retail and test.

I would be very surprised if somebody applies your patch as-is, because it's messy (there are a lot of unnecessary/unrelated changes) and it's very difficult to see the functional changes.

Yes, there is a natural dependency of a patch on the previous ones. This is called a "patch queue" or "patch series", and you can see other people submitting them on qemu-devel. (In fact the most recent series contains 13 patches, with #13 depending on #1-12 being committed already.)

There are tools (such as quilt, guilt, and MQ) that help you manage patch series. You can use these tools to maintain your patches and update them to match the latest qemu tree.

If you submit small independent patches, people will be able to easily see that they're good and commit them instantly. When you submit a large patch with lots of changes, it takes a lot more time and effort to review, and it's much less likely to be accepted.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#4 lore raw

Hi,

I organized my little work in three 'patch queue', one for each argument:

- IIC
MAL (only moved in other place plus 4,5 line added)
- EMAC
- WALNUT MACHINE

There is really need of endless soap for these three change?
Really having only a piece of entire patch about eg IIC will help people to comment this work?

Perhaps is wrong my point of view, but after three times that i mistake in patch , this is a reciprocal time wasting.

My personal opinion is that an integrator, when possible, for a cpu family is needed: not only saying 'this patch is big, this one is uncomprensible', but also to validate how qemu architecture is used or modified relatively to device specification, and how such device specification is reached, at least with coarse-grained; in the case comment about, i thing, is welcome. At least for me.

Have a good day

--- Mer 10/12/08, Hollis Blanchard <[email protected]> ha scritto:

Quoted 66 lines

Da: Hollis Blanchard <[email protected]>
Oggetto: Re: [Qemu-devel] [PATCH 1/3] PPC4xx IIC and MAL
A: [email protected]
Cc: "qemu-devel" <[email protected]>
Data: Mercoledì 10 dicembre 2008, 19:53

Quoted 3 lines · Salvatore Lionetti

Ok

1) The line code modified is 80% IIC, only few row

about MAL

Quoted 1 line

2) MAL until today (if ever this patch enter in qemu)

is only used to

Quoted 2 lines

rw registers, so no malfunction is present.
3) As you can see many ppc* file are to modify since

I2C previous

Quoted 1 line

support it totally not integrated: have sense modify

ppc* and never

Quoted 2 lines

use an IIC device?
4) Is error prone and very tedious to extract some

code, expecially if

Quoted 1 line

there is no modularity advantage: one piece require

the other,

Quoted 1 line

5) I already have successfully tested the expected

patch.

Quoted 1 line

6) I can't do that directly so every time have 2

see if main line is

Quoted 1 line

updated or not, merge svn file with current my patch

status

Quoted 3 lines

7) Who apply the patch only apply one click?

In this moment i have no time to make all this retail

and test.

I would be very surprised if somebody applies your patch as-is, because
it's messy (there are a lot of unnecessary/unrelated changes) and it's
very difficult to see the functional changes.

Yes, there is a natural dependency of a patch on the previous ones. This
is called a "patch queue" or "patch
series", and you can see other
people submitting them on qemu-devel. (In fact the most recent series
contains 13 patches, with #13 depending on #1-12 being committed
already.)

There are tools (such as quilt, guilt, and MQ) that help you manage
patch series. You can use these tools to maintain your patches and
update them to match the latest qemu tree.

If you submit small independent patches, people will be able to easily
see that they're good and commit them instantly. When you submit a large
patch with lots of changes, it takes a lot more time and effort to
review, and it's much less likely to be accepted.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center